[Python-Dev] Re: .DLL vs .PYD search order

Gordon McMillan gmcm@hypernet.com
Wed, 1 Dec 1999 15:19:13 -0500


David Ascher wrote:
> On Wed, 1 Dec 1999, James C. Ahlstrom wrote:
> 
> > > This seems logical -- Python extensions must live in
> > > directories that Python searches (Python must do its own
> > > search because the search order is significant).
> > 
> > The PYTHONPATH search path is what I am trying to get away
> > from.  If I eliminate PYTHONPATH I still can not use the
> > Windows DLL search path (which is superior) because DLLs are
> > searched on PYTHONPATH too; thus my post.  I don't believe it
> > is important for Python module.dll to be located on PYTHONPATH.
> 
> Why is the DLL search path superior?  
> 
> In my experience, the DLL search path (PATH for short) 

Make that:
 [ os.path.dirname(sys.executable),
   os.getcwd(),
   win32api.GetSystemDirectory(),
   os.path.join(win32api.GetSystemDirectory(), '../SYSTEM'), 
   win32api.GetWindowsDirectory()
 ] + string.split(os.environ['PATH'], ';')

> is
> problematic because it requires either using the System control
> panel or modifying autoexec.bat, both of which can have massive
> systemic effects completely unrelated to Python if a mistake is
> made during the modification.

Hear, hear!

[snip]


- Gordon