Moving constants to a configuration file breaks py2exe and py2app
Created originally on Bitbucket by Marginal42 (JonathanH)
Commit 3cead85e5b9f breaks tools that freeze an app which uses openpyxl.
There are two problems:
- The freezing tools in general can only automatically know about Python source files and dynamic libraries, and can't automatically know about data files.
- It's difficult for the user to add the data file "manually" to the packaged app; by default the freezing tools bundle Python files into a .zip archive so a construct like
os.path.dirname(__file__)
doesn't even point to a real directory on disk.
Both py2exe and py2app contain special-case code for handling such data file dependencies (e.g. py2app has a "recipe" for lxml), but I suggest that it would be easier for users if you reverted to the pre-2.3 way of handling these constants rather than wait for py2exe, py2app etc to work around this.
app packaged with py2exe:
...
File "openpyxl\__init__.pyo", line 12, in <module>
IOError: [Errno 2] No such file or directory: '<exe_path>\\library.zip\\openpyxl\\.constants.json'
app packaged with py2app:
...
File "openpyxl/__init__.pyo", line 12, in <module>
IOError: [Errno 20] Not a directory: '<app_path>.app/Contents/Resources/lib/python2.7/site-packages.zip/openpyxl/.constants.json'