0
votes

I tried to create executable of my File NewExistGUI2.py, where GUI is made using wxpython. The file depends upon other two files localsettings.py and Tryone.py. I referred to py2exe documentation, and created a setup.py file as:

from distutils.core import setup    
import py2exe

    setup(name = 'python eulexistdb module',
        version = '1.0',
        description = 'Python eXistdb communicator using eulexistdb module',
        author = 'Sarvagya Pant',
        py_modules = ['NewExistGUI2','localsettings','Tryone']
        )

and compiled the program in command line using

python setup.py py2exe

But I didn't got any .exe file of the main program NewExistGUI2.py in dist folder created. What Should I do now?

1
What was the output from python setup.py py2exe? It should tell you either what's missing, or why it did not create an exe for you.g.d.d.c
try adding: scripts=['NewExistGUI2.py',] to your setup.py.Gabriel Samfira
The output hasn't shown any error message. Its showing byte compiling python files and there is no any error. How do I tell setup.py that NewExistGUI2.py is the main file and localsettings.py, Tryone.py are accessories files.Pant
adding scripts=['NewExistGUI2.py'] didn't worked either. also Tried to add all files into scripts but failed.Pant
So, How can I used PyInstaller then to create EXE of the program.??Pant

1 Answers

1
votes

I woul recommend you create a module (ExistGUI) with the following structure:

ExistGUI
\_ __init__.py
|_ localsettings.py
|_ Tryone.py
bin
\_ NewExistGUI2.py

Your init.py should have:

from . import localsettings, Tryone

__version__ = 1.0

Your setup.py should look something like:

from setuptools import setup, find_packages
import ExistGUI
import py2exe

setup(
     name = 'ExistGUI',
     version = ExistGUI.__version__,
     console=['bin/NewExistGUI2.py'],
     description = 'Python eXistdb communicator using eulexistdb module',
     author = 'Sarvagya Pant',
     packages= find_packages(),
     scripts=['NewExistGUI2.py',],
     py_modules = ['localsettings','Tryone'],
     include_package_data=True,
     zip_safe=False,
)

Then run python setup.py py2exe. Make sure you include any requirements for your module in setup.py. Also, remove the previously generated dist directory, just to be sure.

Hope this helps.