views:

238

answers:

1

"The application failed to initialize properly ... Click on OK,to terminate the application." is the message from the error pop-up. What is the way to catch these errors in Python code?

+1  A: 

Sounds familiar? This will block your subprocess.Popen forever.. until you click the 'OK' button. Add the following code to your module initialization to workaround this issue:

import win32api, win32con
win32api.SetErrorMode(win32con.SEM_FAILCRITICALERRORS |
                      win32con.SEM_NOOPENFILEERRORBOX)
Sridhar Ratnakumar