I'd just do `except OSError, e:` and then `sys.stderr.write("Error: %s\n" % e)` (you're missing the `\n` on the `write()` call).