473,883 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

py2exe problem

First time trying to create an executable with py2exe. I have a small
program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP &
Win2000. The program runs without problem but as an exe it doesn't even get
to showing the GUI.

I get the following error log when I run the executable.

Traceback (most recent call last):
File "mpival3.py ", line 1264, in ?
File "wx\_core.p yc", line 7668, in __init__
File "wx\_core.p yc", line 7320, in _BootstrapApp
File "mpival3.py ", line 364, in OnInit
File "mpival3.py ", line 79, in __init__
File "mpival3.py ", line 204, in restore_inputs
File "mpival3.py ", line 275, in setConfig
File "wx\_controls.p yc", line 621, in SetValue
TypeError: String or Unicode type required

Line 621 in wx\_controls.py c refers to setting the value of a combobox at
the start up of my code. The initial values of various widgets (checkboxes,
textboxes and comboboxes) are stored in a pickled file which is read at the
program start. Running the program, not the exe, shows that the variables
are retrieved properly and of the correct type for the combobox.SetVal ue
method.

Furthermore, if I comment out the code to set the combobox value and
recreate the exe, then I get the same sort of error message for a different
(textbox) widget.

I've read all the py2exe WIKI entries, forum posts and Googled myself
senseless ... now I'm stuck. Can anyone shed any light on this problem, or
have some experience to share?

As an aside, I've found this a very frustrating process at this stage. Never
thought it would be so much trouble. Am I just dreaming in thinking I can
package up my program with this combination of modules?.
fwiw my py2exe setup.py file is included below. It's obviously a concoction
of includes, excludes and other options pieced together from hours of
browsing wiki's etc.

Thanks.

Chris

=============== =============== ====

# setup.py
from distutils.core import setup
import py2exe
import sys

# If run without args, build executables, in quiet mode.
if len(sys.argv) == 1:
sys.argv.append ("py2exe")
sys.argv.append ("-q")
# Matplotlib
# We need to import the glob module to search for all files.
import glob
# We need to exclude matplotlib backends not being used by this executable.
You may find
# that you need different excludes to create a working executable with your
chosen backend.
# We also need to include matplotlib.nume rix.random_arra y
options = {"py2exe": {
"includes": ["matplotlib.num erix.random_arr ay",
"matplotlib.bac kends.backend_t kagg", "encodings" ,
"encodings. *"],
# "includes": ["matplotlib ", "Numeric", "scipy",
"scipy_base "],
# "excludes": ["_gtkagg", "_tkagg"],
"packages": ["pytz"],
"dll_exclud es": ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll']
}
}

# Additional data files are required by matplotlib. Note that the glob.glob
routine
# doesn't seem to pick up the .matplotlib resource file, so I copy that
separately.
# Do the same if you need to
#datf = [(r'matplotlibda ta', glob.glob(r'c:\ python23\share\ matplotlib\*')) ,
# (r'matplotlibda ta',
[r'c:\python23\s hare\matplotlib \.matplotlibrc'])]
datf = [(r'matplotlibda ta', glob.glob(r'c:\ python23\share\ matplotlib\*'))]
# for scipy
excludes = []
includes = ["scipy.special. __cvs_version__ ", "scipy.linalg._ _cvs_version__" ,
"scipy.special. cephes"]
options["py2exe"]["includes"].extend(include s)

# other
#options["py2exe"]["compressed "] = 1
#options["py2exe"]["optimize"] = 2
#options["py2exe"]["ascii"] = 1
#options["py2exe"]["bundle_fil es"] = 3
#options["py2exe"]["skip_archi ve"] = 1

setup(
options = options,
data_files = datf,
name = 'validation',
description = 'Validation Program',
windows = ['mpival3.py']
)


Apr 15 '06 #1
4 4024
bwaha wrote:
First time trying to create an executable with py2exe. I have a small
program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP &
Win2000. The program runs without problem but as an exe it doesn't even get
to showing the GUI.


Do you have more than one wxwindows installed? Check you site-packages.
Do you follow documentation
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls ? Seems like
py2exe picks wrong wxwindows. Insert printing of wx.VERSION and
wx.PlatformInfo and try to run it packaged and non-packaged.

Serge

Apr 15 '06 #2

"Serge Orlov" <Se*********@gm ail.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
bwaha wrote:
First time trying to create an executable with py2exe. I have a small
program which makes use of python23 (2.3.5?), wxpython ('2.6.2.1'),
matplotlib ('0.83.2'), win32com (latest?), Numeric ('23.7') on Windows XP & Win2000. The program runs without problem but as an exe it doesn't even get to showing the GUI.


Do you have more than one wxwindows installed? Check you site-packages.
Do you follow documentation
http://wiki.wxpython.org/index.cgi/MultiVersionInstalls ? Seems like
py2exe picks wrong wxwindows. Insert printing of wx.VERSION and
wx.PlatformInfo and try to run it packaged and non-packaged.

Serge


Thanks for the suggestion, but I definitely have only one version installed.
In fact I uninstalled it and installed an earlier version (2.5.5.1) to see
if it was specifically wxPython related. No change.

Apr 16 '06 #3
bwaha wrote:
Thanks for the suggestion, but I definitely have only one version installed.
In fact I uninstalled it and installed an earlier version (2.5.5.1) to see
if it was specifically wxPython related. No change.


Then why don't you try to print what is passed to SetValue in the exe,
just change windows = ['mpival3.py'] in setup.py with console =
['mpival3.py'] and add prints.

Apr 16 '06 #4

"Serge Orlov" <Se*********@gm ail.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
bwaha wrote:
Thanks for the suggestion, but I definitely have only one version installed. In fact I uninstalled it and installed an earlier version (2.5.5.1) to see if it was specifically wxPython related. No change.


Then why don't you try to print what is passed to SetValue in the exe,
just change windows = ['mpival3.py'] in setup.py with console =
['mpival3.py'] and add prints.


Thanks. Turned out to be user error. I was trying to SetValue(None).
Apr 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2996
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out "import numarray" allows the exe to run. Left in, I get "4.exe has generated errors" etc. I'm going around and around and there isn't much on Google. py2exe output is last.
2
3363
by: Stefan Behrens | last post by:
Hi, does anybody know how I can get py2exe to work with wxPython's wxCalendarCtrl? Currently, I have just a "standard" setup.py, and py2exe gives me a syntax error. Do I need to include any special extension and how? Below is the output I get as well as a small demo app to reproduce the problem.
0
1726
by: Kathleen Kudzma | last post by:
I'm having a problem with py2exe for Python 2.3. I got fixed the Lookuperror no codec search functions registered: can't find encoding by following the instructions on the py2exe page (added -packages encodings --force-imports encodings). This resolved the codec error. When I tried to create an exe with py2exe I still got the following warnings. Please see the new error I got (after warnings). ...
8
4746
by: Kathleen Kudzma | last post by:
Does anyone know how to resolve the following problem that I'm getting in Python 2.2 and 2.3? PROBLEM: When I try to create a classReader object I get an exception: "SAXReaderNotAvailable: No parsers found". This only happens when I run the ..EXE; it does not happen if I run the .PY file. When I'm running the .EXE this exception doesn't happen immediately. It happens as soon as I try to create a classReader object. Please see the...
5
4028
by: Rene Olsthoorn | last post by:
Dear readers, py2exe has a problem including libxml2. Not at building time, but at runtime. The libxml2.dll cannot be loaded... Is there anyone that NOT has the problem? (and can you drop me your setup.py scipt, please). Thanks in advance, Rene O.
6
3958
by: Luc Saffre | last post by:
Hello, I had a strange problem when freezing (using either py2exe or McMillan installer) a script that imports reportlab (which imports PIL (which imports FixTk))). - Python 2.3.3c (also with Python 2.3) - PIL 1.1.4 - Installer or py2exe : latest versions.
2
2688
by: Kylotan | last post by:
I need to be able to build Py2Exe from the source code as I am making a Windows executable where I wish to preprocess the modules before importing them.It looks like I can do this by adding lines to Load_Module() in py2exe's start.c. However problem I have is that I can't build Py2Exe using the instructions provided. Using the designated command of "python setup.py install" I get this error: Traceback (most recent call last): File...
5
2628
by: Lad | last post by:
I try to make an exe file from my script with help of Py2exe but I am not successfull. I have my script start.py that has only one command ############### import rgs.py ############## (rgs.py is the real program.)
1
2367
by: Dave Lim | last post by:
>On May 3, 1:29 pm, Dave Lim <diband... at yahoo.com> wrote: site:http://surguy.net/articles/speechrecognition.xml used out tried ? to protection aroundhttp://mail.yahoo.com I went and
0
9786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10836
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9568
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7964
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5794
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5983
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4211
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3230
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.