Importing package on Windows XP
matthias_zytnicki at voila.fr
Thu Apr 22 05:54:01 EDT 2010
Hello dear Python hackers.
I have a pretty stupid problem that I cannot solve despite all my
efforts: Python cannot find my modules. I am sure the answer is
obvious, but I cannot find it.
The problem is simple, here is a toy example (which does not work).
I have a file:
if __name__ == "__main__":
I have something like
print "I am in module X"
for the files moduleX.py.
The file hierarchy is the following:
"." (which is "C:\Documents and Settings\Administrateur\Bureau\Test")
contains "test.py" (the main file), "module2.py", "module2.pyc" and
the directory "mod". This directory contains "__init.py__" (empty) and
I put the current path (again: "C:\Documents and Settings
\Administrateur\Bureau\Test") into the PYTHONPATH environment variable
(using "set" and the Control Panel) and I added the path into the
PythonPath registers (just in case).
The output of the execution still is:
['C:\\Documents and Settings\\Administrateur\\Bureau\Test', ...]
I am in module 2
Traceback (most recent call last):
File "test.py", line 6 in (module)
from mod import module
ImportError: No module named mod
I really do not know where the error is. It works perfectly well under
Linux and Mac.
Could anyone help me there?
Thanks a lot,
More information about the Python-list