Skip to content

Instantly share code, notes, and snippets.

@roskakori roskakori/
Last active Dec 11, 2015

What would you like to do?
Python OS error codes with symbolic name and human readable error message
# Print a list of possible Python OS error codes together with the symbolic
# name in `errno` and the related human readable error message. The output
# uses Trac Wiki syntax so it can be copied and pasted in a Wiki document
# for later reference.
# The output depends on platform and language settings.
import errno
import os
print('||=code =||=symbol =||=message =||')
for number in sorted(errno.errorcode.keys()):
symbol = errno.errorcode[number]
message = os.strerror(number)
print('||%d||%s||%s||' % (number, symbol, message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.