Ok than you. You're right but it doesn't help me :<br>
I replaced it :<br>
<br>
>>> def finduser(user):<br>
...     if pwd.getpwnam(user):<br>
...             print user, "user exists"<br>
...             return True<br>
...     return False<br>
...<br>
>>> finduser('realuser')<br>
realuser user exists<br>
True<br>
>>> finduser('blabla')<br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in ?<br>
  File "<stdin>", line 2, in finduser<br>
KeyError: 'getpwnam(): name not found: blabla'<br>
<br>
As you can see, i just want to look for a user and if it doesn't exist, an action is taken (create user).<br>
Maybe you have another way to do that check ?<br>
<br>
Thank you <br><br><div class="gmail_quote">2011/8/16 Christian Heimes <span dir="ltr"><<a href="mailto:lists@cheimes.de">lists@cheimes.de</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am 16.08.2011 10:04, schrieb Chris Rebert:<br>
<div class="im">> You can replace the /etc/passwd parsing with a call to pwd.getpwnam():<br>
> <a href="http://docs.python.org/library/pwd.html#pwd.getpwnam" target="_blank">http://docs.python.org/library/pwd.html#pwd.getpwnam</a><br>
<br>
</div>You should replace it. /etc/passwd is not the only source for users.<br>
/etc/nsswitch.conf may list more user and group sources like nis/yp,<br>
LDAP and so on.<br>
<br>
Christian<br>
<font color="#888888"><br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br>