-[laptop1]- -[~]-
-[10:19 AM]-python3
Python 3.5.2 (default, Jul 5 2016, 12:43:10)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> err = IOError("invalid", errno=22)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: OSError does not take keyword arguments
>>> err = IOError("invalid", 22)
>>> try:
... raise err
... except OSError:
... print("test")
...
test
>>>
-[laptop1]- -[~]-
-[10:20 AM]-python2.7
Python 2.7.12 (default, Jul 1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> err = IOError("invalid", 22)
>>> try:
... raise err
... except OSError:
... print("test")
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
IOError: [Errno invalid] 22
>>>