I am building a standalone python3 app for a friend that has no knowledge about code whatsoever. For this app I use multiple modules including tkinter
and openpyxl
. I use py2app
to make my app.
Even though the GUI part of the program works, the methods using the openpyxl
module do not. As my terminal indicates:
Modules not found (unconditional imports):
* StringIO.StringIO (pkg_resources._vendor.six)
* _gdbm (dbm.gnu)
* cjkwrap (texttable)
* com (com.sun.jna)
* com.jna (com.sun)
* com.sun (com.sun.jna.platform)
* copy_reg (pyexcel_io._compact)
* defusedxml (openpyxl.xml.functions)
* itertools.izip (ctypes.macholib.dyld)
* itertools.izip_longest (ctypes.macholib.dyld)
* lxml (openpyxl.conftest, openpyxl.xml.functions)
* lxml.LXML_VERSION (lxml.etree)
* lxml.etree.Element (openpyxl.conftest, openpyxl.xml)
* lxml.etree.ElementTree (openpyxl.conftest, openpyxl.xml)
* lxml.etree.LIBXML_VERSION (openpyxl.xml, openpyxl.xml.functions)
And so on ...
Now I first thought that my setup.py
file was wrong, so I looked into that. Despite the confusion that I still have for the option argv_emulation
I think it is correct.
from setuptools import setup
APP = ['foo.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': False,
'includes': ['time', 'openpyxl', 'pyexcel', 'os', 'platform', 'tkinter']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
The python code works, I have been testing it on a Mac VM, so there is no problem there.
I have noticed that this problem is not new and have found multiple threads treating it including:
- Using py2app with tkinter and openpyxl and multiple files? : but the .egg file only appears in python 2.X
not in python 3
so I don't know how to interpret it
- Moving constants to a configuration file breaks py2exe and py2app : this is exactly my problem, so I followed the patch made for this in 08/2017
Unfortunately, the new openpyxl __init__.py
file does not contain any links to .json files anymore.
So right now I'm at a loss. Any Ideas ?
*Edit : using the exact same code but with the xlwings
module instead of the openpyxl
module works perfectly. But the former opens the files to work in them. This is slow an (imo) not really pretty to work with.