'Using Dash with py2exe; it won't grab the .json files for library.zip
I'm using py2exe to create a desktop executable for my dash app. It's a standalone app, I already have a way to open the app for the user.
Here's my py2exe_setup.py:
from distutils.core import setup
import py2exe
setup(windows=[{
'script': 'server.py',
'dest_base': "AppName"
}],
options={
'py2exe': {
'includes': [
'cx_Logging', 'idna', 'CustomModule'
],
'packages': [
'asyncio', 'flask', 'jinja2', 'plotly', 'packaging', 'dash', 'threading', 'native_web_app'
],
'excludes': [
'tkinter'
],
'dist_dir': './py2exe_build'
}
},
data_files=[('.', ['database.ini'])])
I'm using some custom modules and packages. But I haven't had problems with that yet.
I keep getting the error in the App.log:
Traceback (most recent call last):
File "server.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "dash\__init__.pyc", line 5, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "dash\dash.pyc", line 20, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 627, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "dash\dcc\__init__.pyc", line 24, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\luke.leiter\\Documents\\Programming\\simulator-selector\\src\\SimulatorSelector\\py2exe_build\\library.zip\\dash\\dcc\\package-info.json'
I checked library.zip and the json files for Dash are not being grabbed by py2exe. Copying and pasting the dash package folder didn't work either, the files were transfered and existed but the executable still threw the same error above.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
