peculiar problem
Michael Ströder
michael at stroeder.com
Tue Feb 27 00:54:48 CET 2007
Anil Jangity wrote:
> I notice this in other areas of my code as well.
>
> Here is a trace of a modify:
>
> *** ldap://host:389 - SimpleLDAPObject.modify_ext (('cn=Shilpa J,
> uid=anilj, ou=People, o=entic.net', [(0, 'mail',
> [u'shilpa.j at something.com'])], None, None),{})
> Error - <type 'exceptions.TypeError'>: ('expected a string in the
> list', u'shilpa.j at something.com')
>
>
> The problem is, it seems work on and off. When the modifications or
> searches are done without the unicode string, it works. But later
> when I try to do the same thing again for some reason it trys to do
> the LDAP operation using unicode lists: [u'abc']
>
> Thats when it fails.
You have to pass solely raw strings to python-ldap since the API does
not handle Unicode strings automatically.
u'shilpa.j at something.com'.encode('utf-8')
Ciao, Michael.
More information about the python-ldap
mailing list