Sublime Forum

Variables not working in env for build systems

#1

Hello,

I am trying to create a custom build system for python and to set PYTHONPATH environment variable to the project path.

Currently my build system looks like this:

{ "cmd": "python","${file}"], "env": { "PYTHONPATH":"${project_path}" } }

The issue is that $project_path variable (nor any other variable) is expanded to its value when used in env element, while $file works perfectly in cmd.
At the same time $project_path works properly in cmd

"cmd":"echo","$project_path"]

PYHONPATH is indeed set (checked with os.environ inside my python script) but with the string “$project_path”.

Is it normal that variables are not taken into account in env element ?

I am using Sublime Text 2.0.1 build 2217 on Mac OS X Lion

Thanks
Bye

Filippo

0 Likes

#2

Same problem here. I’m evaluating ST for maintaining a large python library and I need to set PYTHONPATH according to the project root (so that I can use multiple sandboxes). Hugely frustrating!

(BTW, how about using python classes for configuration rather than json? Then the whole language is available giving more flexibility :smile: )

0 Likes

#3

Bump.

I’m having the same problems trying to get my PYTHONPATH to mirror my system path.

0 Likes

#4

Use this to solve problem:

"working_dir": "$project_path",
"env": {"PYTHONPATH": "."}
0 Likes

Sublime Build System PATH does not include system path in linux