trapping DLL import issues without blocking pop up window

Thomas Heller theller at ctypes.org
Fri Nov 2 06:03:57 EDT 2007


alf schrieb:
> Hi,
> 
>   there is following issue: "import cx_Oracle" on windows pops up a nice 
>   'DLL missing' window in case there indeed is no CLI.DLL (or something 
> like that). Then the exception is raised.
> 
> Catching the exception is obviously not a problem, but the popup 
> practically blocks the application and requires user intervention.
> 
> There could be a legitimate case where Oracle environment is not 
> available  yet the program might want to get around it somehow.

Executing this code before 'import cx_Oracle' should help:

  import ctypes; ctypes.windll.kernel32.SetErrorMode(1)

See also http://msdn2.microsoft.com/en-us/library/ms680621.aspx

Thomas




More information about the Python-list mailing list