summaryrefslogtreecommitdiff
path: root/errno
blob: 2a39e2f5359679241b42ca7780cf98a16803813b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python

import errno
import os
import sys

toname = dict((str(getattr(errno, x)), x) for x in dir(errno) if x.startswith("E"))
tocode = dict((x, getattr(errno, x)) for x in dir(errno) if x.startswith("E"))

for arg in sys.argv[1:]:
    if arg in tocode:
        print arg, tocode[arg], os.strerror(tocode[arg])
    elif arg in toname:
        print toname[arg], arg, os.strerror(int(arg))
    else:
        print "Unknown:", arg