Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 8967

Running Python script in Scripts from different working directory in Windows

$
0
0

I have pip installed a library (intelhex) with Python 3.5.1, which also places a few scripts in the Scripts subdirectory of the Python installation:

>dir "%pythonpath%"\hex2* Volume in drive C is System Volume Serial Number is 0000-ABCD Directory of C:\Program Files\Python35\Scripts09.10.2016  08:13             4.698 hex2bin.py09.10.2016  08:13             4.563 hex2dump.py               2 File(s)          9.261 bytes               0 Dir(s)  55.359.901.696 bytes free

One could assume that PYTHONPATH mentioned in the Python on Windows documentation for environment variables might be used for searching scripts, but Python does not find the script if the working directory is another:

>python hex2bin.py flash.hexpython: can't open file 'hex2bin.py': [Errno 2] No such file or directory

PYTHONPATH is intended only as search path for importing modules : https://stackoverflow.com/questions/19917492/how-to-use-pythonpath

Is there a method to use a given path as search path for the Python interpreter?


Viewing all articles
Browse latest Browse all 8967

Trending Articles