I am using Python 3.2 (both for building and executing), and here is my question.
I intend to ship my python application with the following setup:
There is a main script (say, Main.py
), that is using a compiled module, say Module1.pyc
). To be precise, the directory structure is:
.\Main.py
.\__pycache__\Module1.cpython-32.pyc
When I use the python interpreter to run the main script, it fails to find the module with the following error:
Traceback (most recent call last):
File "Main.py", line 10, in <module>
import Module1
ImportError: No module named Module1
Note that I have added the current directory to PYTHONPATH
environment variable, and is part of sys.path
. Also, the inner __pycache__
directory is also added, and is visible in sys.path
.
Not sure why Module1 is not found. Am guessing, it could be because of the different file name - Module1.cpython-32.pyc? But, then that is how the Python 3.2 interpreter generates it.
Module1
, and show so from your dir structure. Then you importModule
and talk about a different filename. So it's hard to know if it's just the fact that you mistyped the module name or if it's actually incorrect. – Gormley