coin-or / coin-or/CyLP

Unable to package CyLP with cx_Freeze

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JetBrains MPS
Stars
192
Forks
70
PR merge metrics
No merged PRs in 30d

Description

It's currently not possible to package a script that uses CyLP using cx_Freeze, due to the way it accesses data files (such as `VERSION`).

```
Traceback (most recent call last):
File "d:\test\gui.py", line 377, in run
import opt
File "d:\test\opt.py", line 54, in
from cylp.cy import CyClpSimplex
File "c:\Python27\lib\site-packages\cylp\__init__.py", line 4, in
__version__ = open(join(currentDir, 'VERSION')).read()
IOError: [Errno 2] No such file or directory: 'D:\\test\\build\\exe.win32-2.7\\library.zip\\cylp\\VERSION'
```

This is due to the way modules are stored in a zip file by cx_Freeze.

https://cx-freeze.readthedocs.org/en/latest/overview.html

> Python modules for your executables are stored in zip files. These can go in three different places:
> - The default is to create a zip file called library.zip and place all modules in this zip file.
> - Each executable can have a private zip file with the same name as the executable (except for the .zip extension).
> - Each executable can have a zip file of modules appended to it. This was the default in earlier versions of cx_Freeze, but it doesn’t work with for creating an RPM, since the RPM builder strips executables.

This should be relatively easy to fix. If I can find some time and there is interest I will try to put in a PR.

https://cx-freeze.readthedocs.org/en/latest/faq.html#using-data-files
https://stackoverflow.com/questions/23351565/issue-packaging-scrapy-spider-with-cx-freeze-or-py2exe/25513413#25513413

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.