Windows Error dialog - 'Errors occurred' - Where is this coming from?
Question: I am dealing with a legacy Python application which uses WxPython, InnoSetup
and py2exe and has a custom sys.excepthook that should deal with all
exceptions. Yet, when an exception occurs, after the custom exception handler
has finished and the main window is closed, this dailog pops up. The worst
part is that it points to a non-existant log file, confusing users. The dialog
reads 'Errors occurred - See the logfile ... for details."

Where could this dialog be coming from? Is this some sort of system default?

[![screenshot](http://i.stack.imgur.com/c99wN.jpg)](http://i.stack.imgur.com/c99wN.jpg)


Answer: It turns out this is due to different effects.

py2exe by default redirects Stderr to a logfile named `sys.executable +
'.log'` and generates that dialog.

When permissions do not allow to write to that folder, it is instead
redirected to `C:\Users\UserName\AppData\Local\VirtualStore\Program Files
(x86)\...`. There, that file actually exists and may give hints to the cause
of the crash.

The last finding I made was that the custom exception handler was activated
way too late. During imports and inits, the program had plenty of opportunity
to crash before the custom handler kicked in.

Some more info on: [py2exe error handling redirection and
popup](http://stackoverflow.com/questions/18835641/py2exe-error-handling-
redirection-and-popup)

