Jul-18-2018, 02:53 PM
(Python 3.6.5)
I've searched this forum and google as well. Lot's of seemingly related problems but nothing really quite like mine.
My problem is earth-shatteringly simple, which makes it all the more frustrating...
I got two python scripts in the same folder, like so:
C:/Projects/Interner
auxScript.py
interner.py
(nothing else in that folder)
interner.py, the "main" program contains only this:
1. After the error, I did:
>>> import os; print(os.listdir("."))
['auxScript.py', 'interner.py']
2. From python interactive console:
>>> import sys; print(sys.path)
['C:\\Tools\\Python\\python365\\python36.zip', 'C:\\Tools\\Python\\python365']
3. Printing system path from inside the main script (had to remove the import of auxScript)
C:\Projects\Interner>python interner.py
['C:\\Tools\\Python\\python365\\python36.zip', 'C:\\Tools\\Python\\python365']
Soooo, while all the manuals on the internet say I can just 'import auxScript' because "script's path is added to sys path", I actually can't and I can easily see that neither my present working dir nor my script's location (which happen to be the same) are added to the sys.path.
Worth mentioning I installed python by unzipping a portable version and adding the executable to the path.
Maybe my installation method was wrong?
I've searched this forum and google as well. Lot's of seemingly related problems but nothing really quite like mine.
My problem is earth-shatteringly simple, which makes it all the more frustrating...
I got two python scripts in the same folder, like so:
C:/Projects/Interner
auxScript.py
interner.py
(nothing else in that folder)
interner.py, the "main" program contains only this:
import auxScriptauxScript.py contains only this:
def printman(): print("Aux is here.")When I run interner.py (from the Interner folder!), I get:
Output:Traceback (most recent call last):
File "interner.py", line 1, in <module>
import auxScript
ModuleNotFoundError: No module named 'auxScript'
Additional info:1. After the error, I did:
>>> import os; print(os.listdir("."))
['auxScript.py', 'interner.py']
2. From python interactive console:
>>> import sys; print(sys.path)
['C:\\Tools\\Python\\python365\\python36.zip', 'C:\\Tools\\Python\\python365']
3. Printing system path from inside the main script (had to remove the import of auxScript)
C:\Projects\Interner>python interner.py
['C:\\Tools\\Python\\python365\\python36.zip', 'C:\\Tools\\Python\\python365']
Soooo, while all the manuals on the internet say I can just 'import auxScript' because "script's path is added to sys path", I actually can't and I can easily see that neither my present working dir nor my script's location (which happen to be the same) are added to the sys.path.
Worth mentioning I installed python by unzipping a portable version and adding the executable to the path.
Maybe my installation method was wrong?