Sublime Forum

Setting PYTHONPATH and PATH variables for Sublime 2

#1

Is there anyway I can set the PYTHONPATH or PATH variable for Sublime?

I’ve installed Lua through Mac Ports, which means luac, required for SublimeLinter doesn’t reside on the default path, but in /opt/local/[s]bin. However Mac Ports adds these to the PATH variable in the .profile file which is loaded when a Terminal runs.

However, it seems (presumably because I’m launching Sublime from the Dock or LaunchBar), that that never happens. If I set the $PYTHONPATH variable in .profile, trying to read it in Python causes a keyerror.

I can, and have, set the evn key in the Python.sublime-build file to reflect the PATH that I want, which works fine, except for Python scripts run by Sublime itself (such as the SublimeLinter ones which cause the issue).

For now I’m adding the Mac Port locations to the PATH in sublimelinter/loader.py which does the trick, but it’s occurred to me that there must be a way of setting the actual environment that Sublime launches in.

Any one got any tips? My Google-fu has run out!

0 Likes