[Techtalk] help with python script for batch useradd
Aaron Malone
aaron at munge.net
Tue Jan 6 15:40:25 EST 2004
On Tuesday 06 January 2004 14:34, Carla Schroder wrote:
> Welcome back!
Thanks. :)
> # python mass_add.py < newusers-deb > passwords.out
> Traceback (most recent call last):
> File "mass_add.py", line 24, in ?
> username, realname = line.split(':')
> ValueError: unpack list of wrong size
[snip]
> I used this list:
>
> dawns,Dawn Marie Schroder,,,,foo
> nikitah,Nikita Horse,,123-4567,equine
> rubst,Rubs The Cat,101,,234-5678,,
Ah, okay. The problem is that my script is written to use colon as the
field delimiter, and you're using a comma. Either change the first
comma in each of the input lines to a colon, or change line 24 of the
script to read:
username, realname = line.split(',', 1)
Note that you MUST include the 1 in that if you want to use comma --
otherwise you'll end up splitting the string at every comma.
--
Aaron Malone
aaron at munge.net
More information about the Techtalk
mailing list