I've just started working with wxPython, using both the book and the
website, and I'm getting some crashes with really basic code. I've
given details below; please let me know if there's any other info
that's relevant.
Thanks in advance for your help!
Sometimes this will run okay the first time through in PythonWin.
However trying to run it again (even after closing the script file and
reopening it) gives the following error before eventually crashing
PythonWin:
Traceback (most recent call last):
File "C:\Python26\Lib\SITE-P~1\PYTHON~1\pywin\framework\scriptutils.py",
line 312, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\Mike\Documents\Programming\wxPython\test.py", line 3,
in <module>
frame = wx.Frame(None, wx.ID_ANY, "Hello World")
File "C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py",
line 505, in __init__
_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
PyNoAppError: The wx.App object must be created first!
The main differences are:
1) Instead of getting the PyNoAppError on the 2nd run, the window
loads and then crashes python
2) The error message I get is a Visual C++ error message, not the
standard Windows "Python.exe has quit unexpectedly" error
At this point I'm thinking that maybe it's the ActivePython
installation that's at fault and maybe I should just get the standard
CPython download from python.org. Or maybe I shouldn't compile the
.py files to .pyc files during the wxPython install.
That, or I should develop on Linux, where most of this would be
pre-packaged in a distro, but since Windows is my main target
platform, I want to get this working. :)
Thanks again,
Mike
2009/3/16 Lucas Boppre Niehues <lucas...@gmail.com>:
> _______________________________________________
> wxpython-users mailing list
> wxpytho...@lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
>
1) Instead of getting the PyNoAppError on the 2nd run, the window
loads and then crashes python
That, or I should develop on Linux, where most of this would be
pre-packaged in a distro, but since Windows is my main target
platform, I want to get this working. :)
I don't know that PythonWin ever worked right with wxPython -- the
mainloops get tangled up, 'cause pythonWin runs your code inside the
same python process as the IDE -- just a plain bad idea, really, though
easy to impliment.
Has PythonWin been updated in years? I thought it was pretty dead.
> PythonWin IDE (both v. 2.5 & 2.6) has
> problems with wxPython 2.8.9.2, even when the App object is explicitly
> destroyed at the end of the script.
wx doesn't take well to stopping and re-starting an App -- you really
can have only one wxApp per run.
> Fortunately, it looks like IDLE doesn't have these problems,
I think IDLE ws re-factored a few years back to run code in a separate
process.
> at least continue learning wxPython and still use a decent IDE.
You can use PythonWin, you just can't run the code from it. There are
also many other options -- google away, but be sure to look at:
BoaConstructor
SPE
Editra
WindIDE
...
If you really want a debugger, WinPDB is nice.
> Interestingly, the interpreter in IDLE output the following string
> when starting either of the scripts: "=====RESTART====";
That may be IDLE's indication that it is starting a new python process
-- which you really need to do to run wxPython.
> I suppose the next step would be to test PythonWin with the last
> stable release of wxPython (2.6.4.0)
don't bother.
Welcome to wxPython -- sorry for the slow start!
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Hi, everyone--
After a variety of testing, with uninstalls and reinstalls between, it
looks like this is something that's the matter with the PythonWin IDE.
(I've detailed my last testing procedure below in case anyone is
yearning for particulars. :)
I have yet to reinstall my Django package, but I feel comfortable at
this point saying that the PythonWin IDE (both v. 2.5 & 2.6) has
problems with wxPython 2.8.9.2, even when the App object is explicitly
destroyed at the end of the script. (While my notes below only talk
about PythonWin 2.6, I was seeing the same problem with my attempts to
use 2.5 earlier today.)
Fortunately, it looks like IDLE doesn't have these problems, so I can
at least continue learning wxPython and still use a decent IDE.
Interestingly, the interpreter in IDLE output the following string
when starting either of the scripts: "=====RESTART===="; neither
PythonWin nor the command line Python did this.
I suppose the next step would be to test PythonWin with the last
stable release of wxPython (2.6.4.0) to see if something in wxPython
changed between releases, but I'm excited to actually do some
programming now that I have things working, so it might be a while
before I get around to that. :)
Thanks again for the suggestions!
--Mike
Testing procedure:
1) Clear all the Python stuff off my computer (uninstall, delete, etc.)
2) Restart to clear the PATH environment variable
3) Install the following:
a. Python for Windows 2.6.1 binary from python.org, full install
b. pywin32-213 package for Python 2.6
c. wxPython 2.8.9.2 w/Unicode package for Python 2.6, compiling
pyc files and making batch files after install
4) Make a copy of python.exe and use it to run the update_manifest.py
file from wxPython
5) Run the offending scripts several times (the one detailed below and
"bare.py" from section 1.2 in "wxPython in Action") from IDLE, via F5
or the "Run -> Run Module" menu command
--> PASS
6) Install the following, rerunning the tests on each script between
each install:
a. PIL 1.1.6
b. cx_Oracle 5.0.1 driver for Oracle 10g
--> PASSed both times
7) Restart
8) Run tests again in IDLE
--> PASS
9) Run script below in PythonWin IDE via either the "Run" toolbar
button or the "File -> Run" menu command--just close the window after
it appears via the "X" button in the upper right-hand corner.
* No arguments passed to script, no debugging
10) Click on "Open File" button or "File -> Open" menu item
--> CRASH after file dialog box opens, with Windows Vista standard
"Pythonwin.exe has stopped working" dialog box
The crash occurs after running the script just once, for what it's worth.
2009/3/16 Lucas Boppre Niehues <lucas...@gmail.com>:
Just an FYI that IDLE will sometimes give a similar message with wx
programs. I can usually get it to work, but when I can't, I just run the
program from the command line. I also use Wingware's Wing IDE and it
works pretty well with wxPython programs too.
There were some screwy issues with Python 2.6, but it seemed to be more
related to building binaries with py2exe than just running the scripts
(as far as I know). I think 2.5 is fine for now though. The 3rd party
packages aren't all up to 2.6 yet anyway.
I'm not sure what Lucas is talking about. I can install the newest
wxPython on the day it comes out on Ubuntu with near zero issues. Some
of the more obscure distros are going to be different. I think most
major distros get their repositories updated within a week of the
release though.
-------------------
Mike Driscoll
Don't run wxPython apps in anything that runs your code in the same
process as the editor/IDE.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!