Adding newusers to Unix system from mysql data (Better Approach)

John J. Lee jjl at pobox.com
Sat Dec 27 07:20:55 EST 2003


"Amy G" <amy-g-art at cox.net> writes:
[...]
> My problem is this...  It writes the data file without problem.  But, the
> os.system... does not necessarily work to add a new user.  By 'not
> necessarily' I mean that it works some of the time, but not all of the time.
[...]
> os.system('adduser -f /home/sean/bin/users.test')
[...]

You're not checking the exit status.  Read the docs for os.system and
os.wait, and look at the commands module.  Then add code to your
program to log details of any failures (the logging module in 2.3 is
useful here), so you can figure out what goes wrong.


John




More information about the Python-list mailing list