stlib name clash when using python as ASP language

Joost JoostMoesker at gmail.com
Thu Feb 1 04:49:49 EST 2007


Hi guys,  I have couple of simple python based active server pages
that make use of httplib2 which uses gzip.py. IIS, however, also has a
gzip.dll located at the iis/inetsrv path.

When using ASP the iis/inetsrv path is placed as the first item in
sys.path. Consequently importing httplib2 will cause the following
error:

    import httplib2
  File "c:\python24\lib\site-packages\httplib2-0.2.0-py2.4.egg
\httplib2\__init__.py", line 25, in ?
    import gzip
ImportError: dynamic module does not define init function (initgzip)

This is, of course, because it tries to load the gzip.dll file instead
of the gzip.py file.

The following per page hack *fixes* the problem most of the time:
import sys
sys.path[0] = "c:/python24/lib"

Strangely, even with this code loaded in every page the import error
sporadically occurs. What would be the preferred way to solve this
name clash?




More information about the Python-list mailing list