[Tutor] C++ Extension Problems

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Sun, 3 Feb 2002 13:43:32 -0800 (PST)

On Sun, 3 Feb 2002, Keule wrote:

> and try to import it into the simannealfile.py modul, but pythonwin
> always gives the following error:
> File "C:\Python21\Pythonwin\pywin\framework\scriptutils.py", line 394, 
> in ImportFile
>     exec codeObj in __main__.__dict__
>   File "<auto import>", line 1, in ?
> ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
> Traceback (most recent call last):
>   File "C:\Python21\Pythonwin\pywin\framework\scriptutils.py", line 301, 
> in RunScript
>     exec codeObject in __main__.__dict__
>   File 
> "C:\Arbeit_Diplomarbeit\__Optimierer\TEM\simannealfile\simannealfile.py", 
> line 2, in ?
>     import simannealfile
> ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
> I checked out the examples, delivered with SWIG, and compared them
> with my Settings under Visual C++. The Examples are all functioned and
> now i absolutly did'nt know whats going wrong and why i always get the
> Errormessage above. I've put my files with these mail. Perhaps anyone
> of you could check my settings an can give me an advice what's going
> wrong.

Hi Keule,

Have you checked to see if this is specifically a PythonWin problem?  
Does the import work in a regular Python console window?  To me, the error
message sounds less like a SWIG problem and more of a PYTHONPATH thing, so
you may want to see if adjusting the PYTHONPATH has any effects.

Also, I don't know if SWIG is guaranteed to work perfectly with C++ code;
you may want to try the Boost Python libraries instead:


Boost Python is designed to make it easy to interface with C++, so it
might fit better with your simulated annealing code.

I can't check if the Visual C++ Makefile is doing the right thing, as I
don't have Visual C++.  I don't know if any of us here at Tutor have too
much experience with Visual C++ and SWIG either.  Your best bet to get
good help may be to contact the SWIG folks here:


Anyway, sorry for the grumpy reply earlier; I reacted badly when I saw so
many attachments, and I apologize for that.