Fail import with SWIG generated imp.load_module ?

MRAB python at mrabarnett.plus.com
Tue Dec 14 13:10:50 EST 2010


On 14/12/2010 08:43, Hvidberg, Martin wrote:
> I'm trying to load a module GDAL into a Python script.
>
> The loader/binderthat is then called, seems to be generated by SWIG, a
> project with which I'm unfortunately not familiar.
>
> The part of the SWIG generated code that fails on me is as follow:
>
[snip]
It _might_ be that imp.load_module(...) is raising an exception, so it
doesn't assign to '_mod', and then it tries to run the 'finally' block
and return _mod. This raises the exception you see and hides the
original cause.



More information about the Python-list mailing list