I want to compile a Python 3.3 module with submodules using cx_freeze.
So my dir strucuture:
projectname/
__init__.py
submodule1/
__init__.py
bootstrap.py
script1.py
submodule11/
script2.py
submodule2/
...
In __init__.pyI import
from submodule1 import bootstrap
and from bootstrap
import submodule1.submodule11.script2
If I run the initialization file, everything is fine, and the script with the import of submodules is executed correctly.
When I compile it, I use this setup.py:
from cx_Freeze import setup,Executable
import sys
includes = []
excludes = ['Tkinter']
packages = ['submodule1', 'submodule2']
base = "Win32GUI"
setup(
name = 'myapp',version = '0.1',description = 'app',author = 'user',
options = {'build_exe': {'excludes':excludes,'packages':packages}},
executables = [Executable('__init__.py',base=base)]
)
and run the script in the 'projectname' directory.
But if I run the application, I get ImportError: no module named 'submodule1.submodule11'errors from the dialog box.
And it's true: in library.zip this submodule does not exist.
What am I doing wrong?
source
share