First time here? Check out the FAQ!
1

Setting PYTHONPATH environment variable not working

I'm using WW with a remote debug session. On the remote machine my .bashrc includes a setting of PYTHONPATH and it works well when running my script via ssh. However, when running through WW debugger the variable is not set. I echoed sys.path and the path does not contain my addition. I also tried adding it via the Project settings in WW but to no avail. How would I do that?

P.S. My setting in the environment is like Environment But querying sys-path yields print("\n".join(sys.path)) /home/thomaskilian/3DP/Server /usr/bin/python3 /usr/lib/python37.zip /usr/lib/python3.7 /usr/lib/python3.7/lib-dynload /home/thomaskilian/.local/lib/python3.7/site-packages /usr/local/lib/python3.7/dist-packages /usr/lib/python3/dist-packages

right after the program start.

os.environ shows 'PYTHONPATH': '/usr/bin/python3'

qwerty_ww's avatar
234
qwerty_ww
asked 2021-09-25 14:44:46 -0600, updated 2021-10-01 15:22:55 -0600
edit flag offensive 0 remove flag close merge delete

Comments

It should work when set in the Project properties dialog. Are you able to set other environment variables and see their values via os.environ?

Wingware Support's avatar Wingware Support (2021-09-27 08:28:37 -0600) edit
add a comment see more comments

1 Answer

0

I suspect you set PYTHONPATH in the Environment in Project Properties and also had the Python Python in Project Properties set to Custom. That overrides PYTHONPATH and sets it instead of using whatever may be set in the Environment or inherited from the outside.

The Python Path is managed separately like this so it can more often work across different development machines and OSes, although you can use either method, just not both of them at once.

Wingware Support's avatar
4.2k
Wingware Support
answered 2021-10-01 12:08:54 -0600
edit flag offensive 0 remove flag delete link

Comments

I tried different ways. But setting it in the project properties did not seem to work. Just like the setting from .bashrc was not recognized. In any case when querying sys.path did not yied any of my settings, but just the standard. See the edit of my question.

qwerty_ww's avatar qwerty_ww (2021-10-01 15:21:05 -0600) edit

What are you setting the python path to? The python path should be a list of directories and something is wrong if os.environ shows 'PYTHONPATH': '/usr/bin/python3'

Wingware Support's avatar Wingware Support (2021-10-01 16:22:33 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer