Notes on ActivePython and IIS

Greg Fortune gfortune at mail.ewu.edu
Wed Jun 30 21:04:49 CEST 2004


I'm on the list so no need to cc: me with your reply...

On Wednesday 30 June 2004 09:29 am, you wrote:
> Greg Fortune wrote:
> > I fought with the python-ldap module last night, but couldn't get it to
> > behave properly.  It would import when working on the command line or
> > through PythonWin, but refused to import through ASP/IIS.  I would get a
> > module not found error message.
>
> Please post a complete traceback.

##############
Without any ldap module installed on the ASP page.
-----------------------------------------------------
Traceback: File "", line 7, in ? 
exceptions.ImportError: No module named ldap
-----------------------------------------------------

From the command line, import ldap gives
>>> import ldap
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named ldap

###############

After copying the contents of the zip file into the site-packages directory.
-----------------------------------------------------
Traceback: File "", line 7, in ? 
exceptions.ImportError: No module named ldap
-----------------------------------------------------

From the command line, it imports successfully.

################
After deleting the necessary files and installing via the .exe, the import is 
successful from both the command line and ASP.

Python version:
2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)]

I wrapped the traceback to make sure we were getting a full traceback as it 
didn't look terribly helpful.  The code on that page is as follows:

<%@ LANGUAGE="Python" %>
<html>
<head></head>
<body>
<%

import sys
if(Server.MapPath('/admin/libs') not in sys.path):
	sys.path.append(Server.MapPath('/admin/libs'))
	
Response.write(str(sys.version) + '<br>')

try:
	import ldap
except ImportError, err:
	(t, val, tb) = sys.exc_info()
	import traceback
	msg =  '-----------------------------------------------------<br>'
	msg += 'Traceback:\n'
	msg += '<br>'.join(traceback.format_tb(tb)) + '<br>'
	msg += '%s: %s<br>' % (t, val)
	msg += '-----------------------------------------------------<br>'
	Response.write(msg)
	

>
> > This morning, I tried the .exe installer from Mauro
> > (python-ldap-2.0.0pre14.win32-py2.3.exe) and it worked like a charm.
>
> Very often I had seg faults when using it with standard Python 2.3.3.

This is with ActivePython, but it might have the same problem :(  I've used 
ldap with 
Python 2.3.3 (#1, May 25 2004, 08:52:15)
[GCC 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)] on linux2
and it seems to work fine.  I'll watch for the segfaults...

Greg Fortune





More information about the python-ldap mailing list