LDIFWriter

Michael Ströder michael at stroeder.com
Fri Jun 3 11:36:51 CEST 2005


Fabio Marcone wrote:
> I need to backup an ldap directory from python. I try to follow example in 
> docs about LDIFWriter but I have this problem: I want to have the ldif output 
> in a file, not in standard output, and so: how can I do? what paramenter I 
> have to pass to LDIFWriter in place of sys.stdout ?

Simply pass a file object as argument:

f = open('/tmp/dirbackup.ldif','wb')
ldif_writer=ldif.LDIFWriter(f)

Ciao, Michael.



More information about the python-ldap mailing list