Comment 64 for bug 365881

Revision history for this message
William Bass (webdunce) wrote :

Hey Ray,

Excellent catch...that "best practice" thing. I glanced at the article when I first discovered SetErrorMode() and totally missed that important info.

Not only that, but I get the idea that it is setting the error mode only for that application...in deed, maybe even only for the particular thread it's called in. So, I think it can be turned off at start up and then there is no reason to even set it back to default before termination.

I opened up two command prompts and ran get_space() on one without calling SetErrorMode() at all and another that called only SetErrorMode(1) ... and never SetErrorMode(0). The command prompt window that didn't call it got the pop-up every time I ran it. The other did not....no matter that I ran the one that turned off the pop-up first...so it should have zero impact on other apps or processes.

That makes the answer clear to me...call ctypes.windll.kernel32.SetErrorMode(1) at start up and forget about it...unless there are other threads that could raise the error (I think I did see code that indicated wubi had more than one thread), then they all would need to call it as well before they were started.