Cx_freeze Does Not Include .py Files From Subdirectories
I'm building a program with Python 3.3, Pyside and lxml amongst others. cx_Freeze was working like a charm until I starting sorting my modules into subdirectories for neatness. cx_
Solution 1:
You should be able to include your packages very simply:
packages = ['lxml._elementpath','lxml.etree', 'parsers', 'constants']
Of course the directories must contain __init__.py
in order to be considered packages.
If this doesn't achieve the desired effect then it would be useful to see the import mechanism used in main.py
to pull these files in. If it's doing anything other than a straightforward import
(or from x import
) this can give cx_Freeze problems finding it.
Solution 2:
You should include your .py
files in the setup.py
script. If the file is not a part of Python itself, cx_freeze needs to know that you want those files included. You should add your extra .py
files with their paths to the includefiles
list. For instance:
import sys
from cx_Freeze import setup,Executableincludefiles= ['open.png', 'appicon.png', 'parsers\xtra_file1.py','constants\xtra_file2.py']
includes = []
excludes = ['Tkinter']
packages = ['lxml._elementpath','lxml.etree']
build_exe_options = {'excludes':excludes,'packages':packages,'include_files':includefiles}
...
Hope this helped.
Post a Comment for "Cx_freeze Does Not Include .py Files From Subdirectories"