3
votes

I have a script "splash.py" stored in C:\Users\cedwards\saved_scripts

I have added this directory in the System Variables in the variable "Path" (Environment Variables)

When I print all the values in sys.path I get ..

>>> import sys
>>> for val in sys.path:
...     print val
... 

C:\Python27\lib\site-packages\openpyxl-2.3.2-py2.7.egg
C:\Python27\lib\site-packages\et_xmlfile-1.0.1-py2.7.egg
C:\Python27\lib\site-packages\jdcal-1.2-py2.7.egg
C:\Python27\Lib
*C:\Python27\Scripts\* C:\Python27\DLLs
*C:\Python27\Scripts\* C:\Python27\Lib\lib-tk
*C:\Python27\Scripts\* C:\Users\cedwards\saved_scripts
C:\WINDOWS\system32\python27.zip
C:\Python27\DLLs
C:\Python27\lib\plat-win
C:\Python27\lib\lib-tk
C:\Python27
C:\Python27\lib\site-packages
C:\Python27\lib\site-packages\win32
C:\Python27\lib\site-packages\win32\lib
C:\Python27\lib\site-packages\Pythonwin
C:\Python27\lib\site-packages\wx-2.8-msw-unicode
>>> 

The values in italics shouldnt be there? The values I entered into PATH are "C:\Python27\lib\site-packages\openpyxl-2.3.2-py2.7.egg;C:\Python27\lib\site-packages\et_xmlfile-1.0.1-py2.7.egg;C:\Python27\lib\site-packages\jdcal-1.2-py2.7.egg;C:\Python27\Lib;C:\Python27\DLLs;C:\Users\cedwards\saved_scripts;C:\WINDOWS\system32\python27.zip;C:\Python27\lib\plat-win;C:\Python27\lib\lib-tk;C:\Python27;C:\Python27\lib\site-packages;C:\Python27\lib\site-packages\win32;C:\Python27\lib\site-packages\win32\lib;C:\Python27\lib\site-packages\Pythonwin;C:\Python27\lib\site-packages\wx-2.8-msw-unicode"

Obvioulsy, when I try and import splash in a new script it does not work.

My question is, why is the *C:\Python27\Scripts* repeating? I think this is what is preventing my module from being imported.

1
could you please edit and add this and see, : `C:\Users\cedwards\saved_scripts\`, that is an extra slash at the end. This was the problem in many cases.powersource97
sys.path in python does not reflect the environmental variable PATH but PYTHONPATH.Klaus D.
powersource97 - tried adding an extra slash, still not workingChris E
Klaus D. - do I then alter PYTHONPATH? There is no such name under system variables. Do I add one?Chris E

1 Answers

0
votes

I have added a user variable named PYTHONPATH with the values stated in my original question and it works.

I shouldnt have added it to PATH in SYSTEM variables