Python crashes - cannot pin it down!

S

Stevie_mac

Figure this!

### Shell1 ###
### testmb.py ###
from wxPython.wx import *
mb = wxMessageBox('hello')


App/Util/Interpreter Running Result
+----------------------+------------------+--------------------
PythonWin Shell1 Crash 1 (see below)
PythonWin testmb.py Crash 2 (see below)
Python.exe testmb.py Crash 3 (see below)
Pythonw.exe testmb.py Crash 4 (see below)
Boa (in shell) Shell1 OK (ran 5 times in a row)
Boa (run module) testmb.py Crash 5 (see below)
Boa (debug run) testmb.py Crash 5 (see below)
SPE 0.4.2.a (in shell) Shell1 OK
SPE 0.4.2.a (in shell) testmb.py OK

I don't get how SPE can run the module but Python.exe and Pythonw.exe can't!
Does SPE initialise somthing I don't!
I don't get how Boa can execute these cmds from the shell even though Python.exe and Pythonw.exe can't!

Is there another Python interpteter involved here?

I did notice an exe called PythonService.exe - is this doing it (i don't believe it is! - never shows in process list & is not installed as a service!)

I'm not that bothered about debugging at the moment, would just like to get the wxPython stuff running reliably.


Confused!



Crash 1...
Faulting application pythonwin.exe, version 0.0.0.0, faulting module wxmsw24uh.dll, version 0.0.0.0, fault address 0x0012cd2a.

Crash 2...
* 1st
Faulting application pythonwin.exe, version 0.0.0.0, faulting module wxmsw24uh.dll, version 0.0.0.0, fault address 0x0012cd2a.
* followed by
Faulting application pythonwin.exe, version 0.0.0.0, faulting module mfc42.dll, version 6.0.8665.0, fault address 0x00001c65.
* followed by
Faulting application pythonwin.exe, version 0.0.0.0, faulting module mfc42.dll, version 6.0.8665.0, fault address 0x00001c65.

Crash 3...
Faulting application python.exe, version 0.0.0.0, faulting module wxmsw24uh.dll, version 0.0.0.0, fault address 0x0012cd2a

Crash 4...
Faulting application pythonw.exe, version 0.0.0.0, faulting module wxmsw24uh.dll, version 0.0.0.0, fault address 0x0012cd2a.
 
S

Stevie_mac

Nearly forgot...

PythonWin 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32.
wxPython 2.4.2.4
WINXP SP1
BOA 0.28
 
V

vincent wehren

Stevie_mac said:
Figure this!

### Shell1 ###



### testmb.py ###
from wxPython.wx import *
mb = wxMessageBox('hello')
<snipped>
Try changing that to:

from wxPython.wx import *
app = wxPySimpleApp()
app.MainLoop()
wxMessageBox("Hello")

HTH,

Vincent Wehren
 
S

Stevie_mac

Woo hoo - It works!

Had to be something I was doing!

Couple of questions...
* Do I need this in every py file (where wx is used) - or just once in say - main() ?
* Do I need to test app == None (or just let app = wxPySimpleApp() occur every time)
* Do I need to Del app afterwards or app.Destroy() or ... ?

Last question, what's happening here! I mean...Is this some form of *required* initialisation of wx?


Finally, Thanks very much for taking the time to respond - Stevie_Mac :happy again:
 
B

Brian Kelley

from wxPython.wx import *
app = wxPySimpleApp()
app.MainLoop()
wxMessageBox("Hello")

Actually, you don't need the app.MainLoop() here. Dialog boxes
essentially start their own main loops. The reason your application was
crashing was because wxPython needs to have an application created
before you can create windows and such, you can think of this as an
initialization step. It's not quite smart enough to know that an
application hasn't been created though, hence the crash.

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top