PythonPath / sys.path
Grizzy Adams
RealGrizzlyAdams at vivaldi.net
Sat May 13 06:42:52 EDT 2023
Hi All
My first post (repeated)
I am having a problem with PythonPath / sys.path
I have a dir where I keep all my current work, but I can't seem to add it to
PythonPath / sys.path
When I try to import one of my modules I see
>>>import My_Working_File
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import My_Working_File
ImportError: No module named 'My_Working_File'
I have tried adding my dir in registry to the existing PythonPath
[HKEY_CURRENT_USER\Software\Python\PythonCore\3.4\PythonPath]
@="D:\\Shades\\Tools\\Python\\Lib;D:\\Shades\\Tools\\Python\\DLLs"
that did not help,
I tried adding PYTHONPATH as an enviramental variable, that also had no effect
(I did re-boot after these two tests)
If I go to the editor window and run (F5) any of my modules then I can
>>> ================================ RESTART ================================
>>>
>>> import My_Working_File
>>>
without error
I can also (from a fresh start)
>>> import sys
>>> sys.path.append(r'D:\Shades\Tools\Python\MyWork')
>>> print(sys.path)
['', 'D:\\Shades\\Tools\\Python\\Lib\\idlelib',
'D:\\Shades\\Tools\\Python\\python34.zip', 'D:\\Shades\\Tools\\Python\\DLLs',
'D:\\Shades\\Tools\\Python\\lib', 'D:\\Shades\\Tools\\Python',
'D:\\Shades\\Tools\\Python\\lib\\site-packages',
'D:\\Shades\\Tools\\Python\\MyWork']
>>> import My_Working_File
>>>
I don't really want to go this route every time I start work, and more to the
point I will need (to learn how) to add dir's to the path at times
I did search the net for an answer but only got what I had already tried
any pointers what I'm doing wrong (other than using windows '->)
Grizz
More information about the Python-list
mailing list