Need a little python assistance for accounts export

seth vidal skvidal at linux.duke.edu
Sat Nov 18 19:58:58 UTC 2006


On Sat, 2006-11-18 at 12:46 -0600, TomLy wrote:
> I am working on the db dumper/ ldap importer and I can't seem to figure
> a couple of things out with the python ldif libraries.  
> 
> I am working on getting the info out to an LDIF file.  I think this is
> accomplished by putting the data into a dictionary (line 200) and making
> a call to LDIFWriter (line 204).  I was hoping that all I had to do was
> pass the dictionary to the unparse function, but that's not working
> right.
> 
> When I call the unparse function I get output like the following:
> 
> dn: dc=fedoraproject,dc=org cn=Tom Lynema
> telephoneNumber: N
> telephoneNumber: o
> telephoneNumber: n
> telephoneNumber: e
> 
> It's always one character per line for some reason.  
> 

I haven't looked at the code - but the above is a good sign you're
iterating over a string object not a list object.

try this and you'll see:

foo='lalalalal'
for item in foo:
   print item


do a type() on the object you're getting the output from above and I bet
it's as string not a list.


-sv





More information about the infrastructure mailing list