On Mon, Aug 5, 2013, at 2:01, Ryan wrote:
if ex.string == '%1 is not...:
ex.winerror == 193, surely. The message probably differentiates by locale, and doing this kind of thing is fragile. For your POSIX case, it looks like the underlying error (likely errno == ENOEXEC) is being caught and wrapped up in an ImportError at some lower level, which apparently isn't being done on windows for whatever reason. So maybe this code should A) have an analogous version written on windows and B) have a more clear error message It's possible that either or both of these cases can't distinguish between attempting to load a library of the wrong architecture, and simply loading a file that is corrupt or simply not a DLL/.so file at all. Have you tried doing so? It _might_ still be a common enough case to be worthwhile to go fishing for evidence that it's the case after getting a generic error that could be that or could be something else, but that's different from just unconditionally rewriting the error message.