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

David Ascher da@ski.org
Wed, 1 Dec 1999 11:59:44 -0800 (Pacific Standard Time)


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) 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.

On UNIX, the equivalent to Windows' PATH is typically LD_LIBRARY_PATH,
although I think there are significant variations in how that works across
platforms.  Most beginning unix users have no idea how to modify their
LD_LIBRARY_PATH, as they typically don't understand the configuration
mechanisms on Unix (system vs. user-specific, login vs. shell-specific,
different shell configuration languages, etc.).

I know it's not what you had in mind, but have you tried doing something
like:

  import sys, os, string
  sys.path.extend(string.split(os.environ['PATH'], ';'))

--david