Ask Your Question
1

Setting PYTHONPATH environment variable not working

asked 2021-09-25 14:44:46 -0500

qwerty_ww's avatar

updated 2021-10-01 15:22:55 -0500

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'

edit retag flag offensive 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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-01 12:08:54 -0500

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.

edit flag offensive delete link more

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 -0500 )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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-09-25 14:44:46 -0500

Seen: 2,248 times

Last updated: Nov 19 '21