python crash on windows but not on linux

Rob Williscroft rtw at rtw.me.uk
Fri Feb 12 17:46:23 EST 2010


hjebbers wrote in news:2864756a-292b-4138-abfd-
3348b72b7e9a at u9g2000yqb.googlegroups.com in comp.lang.python:

> the information about the error is a windows dump.

This may help:

# http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx

SEM_FAILCRITICALERRORS = 1
SEM_NOALIGNMENTFAULTEXCEPT = 4
SEM_NOGPFAULTERRORBOX = 4
SEM_NOOPENFILEERRORBOX = 8


import ctypes
from ctypes.wintypes import UINT

SetErrorMode = ctypes.windll.kernel32.SetErrorMode
SetErrorMode.restype = UINT
SetErrorMode.argtypes = ( UINT,)

Then putting:

SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX )

at the start of you programme, should stop the "Critical Error" dialog 
box you are seeing and you may get a chance to see a traceback.

Rob.



More information about the Python-list mailing list