1

Topic: python create_mail_user_OpenLDAP.py

Hi!
Great piece of software...

Having trouble bulk creating users ... when I run python create_mail_user_OpenLDAP.py it.csv
the script trows the following error:

File "create_mail_user_OpenLDAP.py", line 210, in ?
    domain, username, passwd, cn, quota, groups = re.split('\s?,\s?', entry)
ValueError: need more than 1 value to unpack

Here is an excerpt from my csv file

upang.phinma.edu.ph,mmagoyagoy,mmagoyagoy,Melanie M. Agoyagoy,1024,it
upang.phinma.edu.ph,rgcaspillan,rgcaspillan,Richard G. Caspillan,1024,it
upang.phinma.edu.ph,dicendana,dicendana,Desiree I. Cendana,1024,it
upang.phinma.edu.ph,idmalapit,idmalapit,Iran DV. Malapit,1024,it

Thanks

2

Re: python create_mail_user_OpenLDAP.py

Was surprised to find out that ldif file was actually generated despite the
the errors. I Imported the ldif file via phpLDAPadmin and users were generated.

This is semi-solved for me.

Follow up question...
Deleting users in iRedAdmin would not delete Maildir? Can it
be done so that Deleted users MailDirs are also deleted from disk?

Thanks.

3

Re: python create_mail_user_OpenLDAP.py

afaquino wrote:

Follow up question...
Deleting users in iRedAdmin would not delete Maildir? Can it
be done so that Deleted users MailDirs are also deleted from disk?

No plan to delete mailbox in file system yet due to possible security issue.

But patches/contributions are always welcome smile

4

Re: python create_mail_user_OpenLDAP.py

Hi,

i got the same error when you have blank lines or headers (when generating the csv file from excel or openoffice calc)

just remove it

Idea :
to know the on which line the error is :
change the code as :
for lineno, entry in enumerate(userList):
    entry = entry.rstrip()
    print "<INFO> Processing Line %d" % lineno

i should find a way to print only when there is an error

5

Re: python create_mail_user_OpenLDAP.py

Thanks saidmsl...

I am not in the office right now ... I'll try to follow your
advise later and report on the outcome.

iRedMail Rocks!

6

Re: python create_mail_user_OpenLDAP.py

I think the problem occured when you left empty line at the end of csv file. When you remove it it should generate without any errors.

7

Re: python create_mail_user_OpenLDAP.py

kerie wrote:

I think the problem occured when you left empty line at the end of csv file. When you remove it it should generate without any errors.

This one solved it for me