I have created a simple python gui app using Tkinter (tested on python v2 and v3) and am trying to use py2app and py2exe to distribute it.
I need the following libraries:
- boto3 (local copy downloaded to root folder)
- decimal
- json
- requests
- Tkinter (Tkinter for v2, tkinter for v3. Used
try... except ImportError:...
to get proper one) - hashlib
- time
And I have 3 modules I've written:
- NVConnectApp.py
- NVServer.py
- DroneLogbookServer.py
My setup.py currently looks like this using help from this tutorial:
'''
py2app/py2exe build script for NVConnectApp.
Will automatically ensure that all build prerequisites are available
via ez_setup
Usage (Mac OS X):
python setup.py py2app
Usage (Windows):
python setup.py py2exe
'''
import ez_setup
ez_setup.use_setuptools()
import sys
from setuptools import setup
mainscript = 'NVConnectApp.py'
if sys.platform == 'darwin':
extra_options = dict(
setup_requires=['py2app'],
app = [mainscript],
# Cross-platform applications generally expect sys.argv to
# be used for opening files.
options=dict(py2app=dict(argv_emulation=True)),
# Packages
packages=['boto3'],
# Modules
py_modules = ['DroneLogbookServer', 'NVServer']
)
elif sys.platform == 'win32':
extra_options = dict(
setup_requires=['py2exe'],
app=[mainscript],
# Packages
packages=['boto3'],
# Modules
py_modules = ['DroneLogbookServer', 'NVServer']
)
else:
extra_options = dict(
# Normally unix-like platforms will use "setup.py install"
# and install the main script as such
scripts=[mainscript],
)
setup(
name="NVConnectApp",
**extra_options
)
OSX (python 2.7.8):
I am getting errors when opening py2app's .app for OSX. The error has to do with Boto3's configparser that's been solved here. The error doesn't occur when I run the program from the raw script though.
Windows (python 3.4.3):
When running python setup py2exe
I get an error that says error: invalid command 'py2exe'
. A little research says because I didn't import py2exe in Setup.py, but after importing it (after importing setup) I get the following:
3 missing Modules
------------------
? readline imported from cmd, code, pdb
? win32api imported from platform
? win32con imported from platform
Building shared code archive 'dist\library.zip'.
and no .exe is generated.
What is wrong with my Setup.py?