Cx_freeze: Not a directory

I am trying to build a binary on Linux (Manjaro Linux, x86_64, python 3.4). My application is graphical software written with PyQt.

Here is my setup.py:

import sys
import os
from cx_Freeze import setup, Executable

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"


my_data_files = ["./images/", "./journals/", "./config/"]


# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"],
                     "excludes": [
                                  "tkinter"
                                 ],
                     'includes': [
                                  'sip',
                                  'PyQt4.QtCore',
                                  'PyQt4.QtGui',
                                  'PyQt4.QtNetwork',
                                  'PyQt4.QtSql',
                                  'scipy.sparse.csgraph._validation',
                                  'sklearn.utils.sparsetools._graph_validation',
                                  'scipy.special._ufuncs_cxx'
                                 ],
                     'include_files': my_data_files
                    }


setup(name = "guifoo",
      version = "0.1",
      description = "My GUI application!",
      options = {"build_exe": build_exe_options},
      executables = [Executable("gui.py", base=base)])

      

While I'm just getting started. The "includes" part in the option is what I used when I compiled my binary with py2exe (it worked, but I want a unique tool to be created for all platforms).

When I start compiling with

python setup.py build

      

everything works fine, but when I try to run the binary, I have this exception:

NotADirectoryError: [Errno 20] Not a directory: '/home/djipey/Desktop/test/build/exe.linux-x86_64-3.4/library.zip/text_unidecode/data.bin'

      

So, I guess I have a problem with the text_unidecode module, but I can't figure out what the problem is.

Could you give me your hand?

EDIT:

Okay, sorry for the lack of precision, I didn't copy / paste the entire error message:

File "/usr/lib/python3.4/site-packages/text_unidecode/__init__.py", line 6, in <module>
    with open(_data_path, 'rb') as f:
NotADirectoryError: [Errno 20] Not a directory: '/home/djipey/Desktop/test/build/exe.linux-x86_64-3.4/library.zip/text_unidecode/data.bin'

      

I think the problem may be coming from text_unidecode, but I don't know why. I installed it without any problem on my computer.

https://github.com/kmike/text-unidecode/blob/master/src/text_unidecode/ init .py

EDIT 2: If I integrate the text-unidecode (it's basically one function) into my own code, it works. I seem to know why I am having this problem. In text-unidecode, there is a file called data.bin that contains the data used by the text-unidecode function. It is part of the library, but it is not added to library.zip when I use cx_freeze. So text-unidecode cannot work.

Is there an elegant way to solve this with cx_freeze? Alternatively, add data files to library.zip?

+3


source to share





All Articles