Nested scopes resolution -- you can breathe again!

David Bolen db3l at fitlinxx.com
Wed Feb 28 02:26:13 CET 2001


Robin Becker <robin at jessikat.fsnet.co.uk> writes:

> yes, but it would be just as easy to get the failure to do that. The
> message may come from windows, but the extension (in our case zlib)

The reason I suggested placing a python15.dll on the system is to get
rid of the Windows message, leaving it just to the Python ImportError.

> still wasn't loaded and that should have been enough, but we had a
> try/except around the particular import. Finding a matching pyd/dll
> which then fails to load is surely not 'just an import error' even if it
> eventually gets raised as one.

Well, but it doesn't have to be too much work.  I'm thinking of the
specific ImportError of:

 "Module use of python15.dll conflicts with this version of Python."

in which case you know that you have an old extension (which has to be
on Python's sys.path somewhere), and that one of three things are
true:

1. The imported module directly depends on python15.dll (probably most
   likely for C extension modules being directly imported, like zlib).
2. The module you imported itself imports some other module with the
   dependency - in that case you have the traceback showing which import
   of which module failed, which reverts to the prior 1.
3. The module has a Windows DLL dependency which eventually pulls in
   python15.dll.  In this case, you know the top level module, so use
   a standard windows tool like depends to check the dependencies.

It's really only case (3) where you need something more than Python
itself provides, but even in (3) you know the module to check, and
it's a relatively straight forward path to fully identifying the root
cause.  It should also be reasonably rare since most extension modules
directly use python15.dll rather than linking to another DLL which itself
is the extension.

Of course, none of this is to excuse the mess that is Windows DLL-land :-)

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list