Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 14-12-2006, 12:21 PM   #1
 
CyberNerd's Avatar
 
Join Date: Jan 2006
Posts: 3,444
Thanks: 49
Thanked 150 Times in 123 Posts
Rep Power: 39 CyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to behold
Default Python LDAP module version problem

Ages ago I wrote a python program on v2.3 - it works fine. I was re-writing the original program to do something else and I noticed it failed using a newer version of python/python-ldap.
I'm not sure why, but would rather update the program than downgrade python module. Any pointers please. :?

this works:
python-ldap.i386 0:2.0.1-2

Code:
python
Python 2.3.4 (#1, Oct 11 2006, 06:18:43)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ldap
>>> domain = "example.com"
>>> l=ldap.initialize("ldap://server."+domain+":389")
>>> l.simple_bind_s("domain\\username","password")
>>>
this fails:
Python-ldap version: 2.0.4-1ubuntu4

Code:
Python 2.4.3 (#2, Oct  6 2006, 07:49:22)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ldap
>>> domain = "example.com"
>>> l=ldap.initialize("ldap://server."+domain+":389")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'initialize'
  Reply With Quote
Old 14-12-2006, 12:34 PM   #2
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Python LDAP module version problem

The ldap.initalise function doesn't exist anymore in the python-ldap module in ubuntu. The function has been renamed to ldap.open().
  Reply With Quote
Old 14-12-2006, 12:47 PM   #3
 
CyberNerd's Avatar
 
Join Date: Jan 2006
Posts: 3,444
Thanks: 49
Thanked 150 Times in 123 Posts
Rep Power: 39 CyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to behold
Default Re: Python LDAP module version problem

thanks, but I'm gettign the other errors with ldap.open().
I've got something half working, but how much do these things change in python? is there any way of achieving backwards comatibility other than keeping another install of older versons?
  Reply With Quote
Old 14-12-2006, 12:52 PM   #4
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Python LDAP module version problem

No, go read the api documentation for ldap-python and fix your script.
  Reply With Quote
Old 14-12-2006, 01:17 PM   #5
 
CyberNerd's Avatar
 
Join Date: Jan 2006
Posts: 3,444
Thanks: 49
Thanked 150 Times in 123 Posts
Rep Power: 39 CyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to behold
Default Re: Python LDAP module version problem

now I'm really confused.
"current" documentation is 2004 for v2.03 and states:
Quote:
The following example demonstrates how to open an LDAP server using the ldap module.

>>> import ldap
>>> l = ldap.initialize("ldap://my-ldap-server.my-domain:389")
>>> l.simple_bind_s("","")
>>> l.search_s("o=My Organisation, c=AU", ldap.SCOPE_SUBTREE, "objectclass=*")
The example (no docs I could find) in the latest python-ldap v2.2.1 also uses ldap.initialize:

Quote:
# Create LDAPObject instance
l = ldap.initialize('ldaps://localhost:1636',trace_level=ldapmodule_trace_level ,trace_file=ldapmodule_trace_file)
# Set LDAP protocol version used
l.protocol_version=ldap.VERSION3
# Try a bind to provoke failure if protocol version is not supported
l.bind_s('','',ldap.AUTH_SIMPLE)
# Close connection
l.unbind_s()
So is this ldap.initialize problem specific to Ubuntu's implementation?
  Reply With Quote
Old 14-12-2006, 02:01 PM   #6
 
CyberNerd's Avatar
 
Join Date: Jan 2006
Posts: 3,444
Thanks: 49
Thanked 150 Times in 123 Posts
Rep Power: 39 CyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to beholdCyberNerd is a splendid one to behold
Default Re: Python LDAP module version problem

I just tried the original script on Zenwalk with python 2.4 and python-ldap 2.2.1 and it worked fine.
I think this must be a problem with (my) ubuntu 6,06amd64. or the 2.04 version of python-ldap.
  Reply With Quote
Old 14-12-2006, 02:18 PM   #7
 
Geoff's Avatar
 
Join Date: Jun 2005
Location: Fylde, Lancs, UK.
Posts: 9,931
uk uk lancashire
Thanks: 42
Thanked 230 Times in 209 Posts
Blog Entries: 1
Rep Power: 67 Geoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud ofGeoff has much to be proud of
Send a message via ICQ to Geoff Send a message via AIM to Geoff Send a message via MSN to Geoff Send a message via Yahoo to Geoff Send a message via Skype™ to Geoff
Default Re: Python LDAP module version problem

The LDAP Python homepage is here.

http://python-ldap.sourceforge.net/

current docs are here.

http://python-ldap.sourceforge.net/docs.shtml
  Reply With Quote
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Module raid 456 error TechMonkey *nix 1 26-11-2007 05:32 PM
IE 7.0 ROK Slideshow Module in Joomla. CSS / IE Problem bensewell Web Development 0 06-09-2007 01:47 PM
PDF Creater version 0.9.3 default printer problem pburchell Windows 9 22-02-2007 06:49 PM
Python script ,escaped quotes - zimbra account autocreation CyberNerd Scripts 4 27-06-2006 07:52 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 08:16 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net