> Note that all modules in python-ldap up to 2.4.10 including module 'ldif' > expect raw byte strings to be passed as arguments. It seems to me you're > passing a Unicode object in the entry dictionary which will fail in case an > attribute value contains NON-ASCII chars.
Yup, I was. > python-ldap expects raw strings since it's not schema-aware and therefore does > not have any knowledge about the LDAP syntax used for a particular attribute > type. So automagically convert Unicode strings will likely fail in many cases. > => The calling application has to deal with it. I see, that recco went a long a way in cleaning up my code actually and making the handling of decoding and encoding more consistent. > Don't muck with overriding _unparseAttrTypeandValue(). Simply pass the > properly encoded data into ldif module. I had some time today, so I attempted to open the ldif files in binary mode to simply work with the raw byte strings but the moment the first entry was parsed, parse() stumbled on a character in the first entries dict and passed a dn of None for the last half? If the option to avoid worrying about decoding and encoding could work, I would be happy to process the whole lot in byte strings. Any idea what may cause this? Thanks a lot Michael, jlc -- http://mail.python.org/mailman/listinfo/python-list