Jul-29-2019, 11:53 PM
How do I set the path to my module one directory below my python 3.7.3 program?
I was able to have success using
--- import sys
--- sys.path.append("DEAC/0-files")
--- import DeacModule
so I can get my work done.
My question is about an alternate approach found at:
https://python-forum.io/Thread-Basic-Modules-part-3
which shows this format
--- import dir1.dir2.mod
--- from dir1.dir2.mod import Klass
My code uses:
--- import DEAC.0-files.DeacModule
which, despite trying variations on the path, always gets this error:
----------
File "/Users/deacimac6/DROPBOX/A PGMG/PycharmProjects/DEAC/Modules.py", line 117
import DEAC.0-files.DeacModule
^
SyntaxError: invalid syntax
----------
With indenting it looks more like this (with spaces instead of "-")
----------
--File "/Users/deacimac6/DROPBOX/A PGMG/PycharmProjects/DEAC/Modules.py", line 117
----import DEAC.0-files.DeacModule
--------------------^
SyntaxError: invalid syntax
----------
With a minor name change I have also received this error:
ModuleNotFoundError: No module named 'DEAC'
Can you see what's wrong with my syntax?
I was able to have success using
--- import sys
--- sys.path.append("DEAC/0-files")
--- import DeacModule
so I can get my work done.
My question is about an alternate approach found at:
https://python-forum.io/Thread-Basic-Modules-part-3
which shows this format
--- import dir1.dir2.mod
--- from dir1.dir2.mod import Klass
My code uses:
--- import DEAC.0-files.DeacModule
which, despite trying variations on the path, always gets this error:
----------
File "/Users/deacimac6/DROPBOX/A PGMG/PycharmProjects/DEAC/Modules.py", line 117
import DEAC.0-files.DeacModule
^
SyntaxError: invalid syntax
----------
With indenting it looks more like this (with spaces instead of "-")
----------
--File "/Users/deacimac6/DROPBOX/A PGMG/PycharmProjects/DEAC/Modules.py", line 117
----import DEAC.0-files.DeacModule
--------------------^
SyntaxError: invalid syntax
----------
With a minor name change I have also received this error:
ModuleNotFoundError: No module named 'DEAC'
Can you see what's wrong with my syntax?