[Tutor] Problems using a .dll file under windows

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Thu, 31 Jan 2002 22:46:41 -0800 (PST)

On Fri, 1 Feb 2002, Keule wrote:

> I generated a simannealfilec.dll with SWIG and also a python shadow 
> class named simannealfile.py.

Cool; I'm also playing with SWIG at the moment.  Wrapping C code with SWIG
is somewhat of an advanced topic; you may be able to get better help by
talking with the SWIG folks at:


You may want to ask your question on the SWIG mailing list as well, since
they may have run into this issue already.

>  >>> Traceback (most recent call last):
>   File "C:\Python21\Pythonwin\pywin\framework\scriptutils.py" , line 
> 394, in ImportFile
>     exec codeObj in __main__.__dict__
>   File "<auto import>", line 1, in ?
>   File "C:\Arbeit_Diplomarbeit\__Optimierer\AG_TEMdll\simannealfile.py" 
> , line 2, in ?
>     import simannealfilec
> ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

... hmmm... Give me a moment while I bring up Babelfish... Ah!  Here's the
translation of "Das angegebene Modul wurde nicht gefunden": "The indicated
module was not found".  (Wow, Babelfish is impressive!)

My best guess so far at the problem is that the directory:


isn't in the 'sys.path' list that Python uses to search for modules.  To
test this hypothesis, can youtry doing this right before importing the
'simannealfilec' module:

import sys

?  If this helps, then it's a PYTHONPATH issue.

Does anyone know what Pythonwin's behavior is when running scripts ---
does it add that script's path to sys.path?  This is starting to feel like
that silly IDLE "Run Script" issue from last month.