How do I get Win32 to locate DLLs elsewhere (not really a Python thing)?

Robin Dunn robin at
Wed Mar 14 00:03:18 CET 2001

"Skip Montanaro" <skip at> wrote in message
news:mailman.984506597.12469.python-list at
> I'm trying for the first time to use Python (2.0) on Win98 with external
> DLLs (GTK/GDK/...).  I installed all the various bits and pieces for
> GIMP/GTK and PyGTK, but three DLLs that come with GIMP/GTK are not where
> Windows is searching for them, so I get import errors.  (GIMP runs
> fine.) Using a tool called the dependency walker (something from MS) I
> am able to extend its module search directories to include C:\Program
> Files\Common Files\GNU so it will resolve those DLLS.
> How do I perform that trick so that Microsoft's equivalent of can
> find them at run-time?

I don't remember the search order off the top of my head, but DLLs are
normally searched for in the following locations:

1. The directory where the loading .exe is.  For Python that can be
python.exe or pythonw.exe, but it also works if the DLL is where the .pyd
file is at if it is the one that links to the DLL.

2. The SYSTEM directory.  (c:\windows\system or something similar)

3. The directories on the PATH environment variable.  Since you are on win98
you probaly have a c:\autoexec.bat that sets this variable.  If you edit
this you will need to reboot for it to take effect globally.

Perhaps the easiest is to copy the various gtk DLLs to the directory where
the _gtk.pyd file is located.  Perhaps better is to add the path where they
are already to the PATH and reboot.

Robin Dunn
Software Craftsman
robin at       Java give you jitters?      Relax with wxPython!

More information about the Python-list mailing list