modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.)

This commit is contained in:
Giampaolo Rodola' 2013-02-12 15:14:17 +01:00
parent b071d4f3da
commit 0166a283f6
6 changed files with 27 additions and 51 deletions

View file

@ -850,8 +850,7 @@ if __name__ == '__main__':
nobody = pwd.getpwnam('nobody')[2]
try:
os.setuid(nobody)
except OSError as e:
if e.errno != errno.EPERM: raise
except PermissionError:
print('Cannot setuid "nobody"; try running with -n option.', file=sys.stderr)
sys.exit(1)
try: