Sublime Forum

Python Build System PYTHONPATH problem

#1

Hi,

I’m getting an import error in python using the following JSON for my build system. The imports work fine with PyCharm, for some reason the git root, which is also the sublime root path is not getting added to PYTHONPATH. I’m noticing that the $folder variable is not getting substituted and it still reads $folder

Any ideas? Thanks !

    "cmd": ["/Users/no/venvs/python3/bin/python3", "-u", "$file"],
    "working_dir": "$folder",
    "selector": "source.python",
    "env": {
            "PYTHONPATH": "$folder",
            "table_name": "no",
            "PYTHONIOENCODING": "utf-8"
            }

}
0 Likes

#2

According to https://www.sublimetext.com/docs/3/build_systems.html variables like $file or $folder are supported in "cmd", "shell_cmd" and "working_dir" only.

As it looks like you are using virtualenvs - Did you try the virtualenv package?

0 Likes