Bugs item #1069410, was opened at 2004-11-19 15:02 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1069410&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: Dimitri Papadopoulos (papadopo) Assigned to: Nobody/Anonymous (nobody) Summary: import on Windows: please call SetErrorMode first Initial Comment: Hi, We have a problem with "import" on Windows XP. If we attempt to import a missing Python module, an exception is raised. That's OK. If we attempt to import an existing Python module depending on a missing DLL, then the Windows runtime will pop up an error message, before the exception is raised by Python. That's not OK. I would expect an exception should be thrown, but I believe the Windows error message should not be displayed. I guess the error message originates in the win32 LoadLibrary function: http://msdn.microsoft.com/library/en-us/dllproc/base/loadlibrary.asp According to this documentation: To enable or disable error messages displayed by the loader during DLL loads, use the SetErrorMode function. SetErrorMode is documented here: http://msdn.microsoft.com/library/en-us/debug/base/seterrormode.asp I believe Python should handle the DLL error instead of letting the system handle it. The default behavior is not appropriate for most Python programs. The Python way of dealing with errors is raising an exception, not passing errors to the system and let it pop up platform specific error messages. We're running Python 2.3.4 on Windows XP. Background: The problems occurs when importing the PyMat library. This Matlab wrapper depends on a Matlab DLL. We don't know before hand whether Matlab is present or not on the system. We expect import pymat to raise an exception if Matlab is not installed. We don't want the user to have to click in the annoying control popped up by the Windows runtime. ---------------------------------------------------------------------- >Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-06-26 08:21 Message: Logged In: YES user_id=1188172 That seems to be a correct wish. Is there any problem with SetErrorMode? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1069410&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com