[Python-Dev] Importing extensions on Windows 95

M.-A. Lemburg mal@lemburg.com
Mon, 30 Apr 2001 14:53:21 +0200


Mark Hammond wrote:
> 
> > Interestingly, the problem only shows up when starting Python
> > from the installation directory. Looking at the imports using
> > python -vv shows that in this situation, Python tries to import
> > modules, packages, extensions etc. using *relative* paths.
> 
> I'm not quite with you here.  Are you saying both Win98 and 95 use relative
> paths, but only Win95 has the problem, or that only Win95 sees relative
> paths?

Both are using relative paths, but only Win95 has a problem with not
finding the DLL needed by a PYD file in a subpackage:

abc/
    __init__.py
    mxABC.pyd
    mamba.dll

mxABC.pyd needs mamba.dll.
 
> My Win98 box uses absolute paths for all imports when using -vv

Are you sure ? Please CD to the C:\Python21 dir and then try
to import and installed package (say mx.Tools from egenix-mx-base).
You should be seeing relative paths with -vv.
 
> > Would it be hard to tweak Python into always using absolute search
> > paths during module import ?
> 
> Where are the relative paths coming from?  If we can determine that, we can
> determine how hard it would be to fix ;-)

The relative paths come from the import logic: the current dir
is scanned first and if the package is found in that directory,
all subsequent lookups are done using relative paths.

While this is prefectly OK, Win95 seems to have a problem with
importing extensions using these relative paths. I think we could
solve the problem by making the pathname which is passed to
LoadLibraryEx() in dynload_win.c absolute.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/