Sublime Forum

Build Systems not correctly searching PATH on macOS

#1

So this is related to my other post.

I had a Python script that wasn’t building correctly in ST4 but would execute fine in zsh terminal on macOS. After doing some troubleshooting I finally got the system PATH to match between ST4 and zsh when I ran my Python script. However… I also added this to the top of file:

import sys
print(sys.version)
print(sys.executable)

Low and behold it showed that ST4 was running the Python executable version 3.9.6 from X code of all places:

3.9.6 (default, Oct 18 2022, 12:41:40) 
[Clang 14.0.0 (clang-1400.0.29.202)]
/Applications/Xcode.app/Contents/Developer/usr/bin/python3

When I run the same shell_cmd that ST4 used but in terminal, I got this:

3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:14:12) [Clang 14.0.6 ]
/opt/anaconda3/bin/python3

This was the expected behavior in terminal as I’m using Anaconda for my package manager.

Since the PATH is set the same between my bash and zsh profiles (and this is confirmed in the ST4 console when I run Build), then there must be some error preventing ST4 from properly finding the correct version of Python on the PATH.

Changing the shell_cmd in my Python.sublime-build file to the full path to my Python file did fix the error, but again this shouldn’t need to be done.

0 Likes