-1

I am using Py2exe to create a executable app for my GUI and this is my setup code:

import matplotlib
from distutils.core import setup
import FileDialog
import zmq.libzmq

import py2exe
setup(
 data_files=[matplotlib.get_py2exe_datafiles(),(zmq.libzmq.__file__,)],
 console = [{'script': 'SVS-virtual-lib2.py'}],
 options={
         'py2exe': {
                 'packages': ['FileDialog'],
                 'includes': ['zmq.backend.cython'],
                 'excludes': ['zmq.libzmq'],
                 'dll_excludes': ['libzmq.pyd']
                 }
        }
)

But i get the following error:

  File "C:\Users\nzarinabad\AppData\Local\Continuum\Anaconda\lib\distutils\util.py", line 128, in convert_path
    paths = string.split(pathname, '/')
  File "C:\Users\nzarinabad\AppData\Local\Continuum\Anaconda\lib\string.py", line 294, in split
    return s.split(sep, maxsplit)
AttributeError: 'tuple' object has no attribute 'split

Dose anyone who why i get the error and how to fix it? Thank you

2
  • I don't know distutils or py2exe at all well, but I'd guess that data_files is supposed to be a sequence of strings, not a nested list of lists. Try data_files=matplotlib.get_py2exe_datafiles() + [zmq.libzmq.__file__] perhaps? Commented Jul 17, 2015 at 11:27
  • possible duplicate of using py2exe with wxPython and Matplotlib Commented Jul 17, 2015 at 11:42

1 Answer 1

1

Please see the documentation, if you want to combine matplotlib.get_py2exe_datafiles() with other files, you have to do some manual work:

from distutils.core import setup
import py2exe

from distutils.filelist import findall
import os
import matplotlib
matplotlibdatadir = matplotlib.get_data_path()
matplotlibdata = findall(matplotlibdatadir)
matplotlibdata_files = []
for f in matplotlibdata:
    dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:])
    matplotlibdata_files.append((os.path.split(dirname)[0], [f]))

matplotlibdata_files.append(zmq.libzmq.__file__)

# ...

setup(
 data_files=matplotlibdata_files,
# rest of your code
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer, I changed that, but still getting same error. File "C:\Users\nzarinabad\AppData\Local\Continuum\Anaconda\lib\string.py", line 294, in split return s.split(sep, maxsplit) AttributeError: 'tuple' object has no attribute 'split' When I run my GUI itself in python it works fine, can it be something in my gui code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.