[issue20384] open() exception doesn't contain file name on Windows

Mark Lawrence report at bugs.python.org
Fri Jan 24 20:51:43 CET 2014


Mark Lawrence added the comment:

Two attempts, one with the pipe "|" symbol in the mode, one without.

>>> import tarfile; tarfile.open('non-existing', 'r|')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python33\lib\tarfile.py", line 1594, in open
    stream = _Stream(name, filemode, comptype, fileobj, bufsize)
  File "C:\Python33\lib\tarfile.py", line 362, in __init__
    fileobj = _LowLevelFile(name, mode)
  File "C:\Python33\lib\tarfile.py", line 335, in __init__
    self.fd = os.open(name, mode, 0o666)
FileNotFoundError: [Errno 2] No such file or directory

>>> import tarfile; tarfile.open('non-existing', 'r')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python33\lib\tarfile.py", line 1566, in open
    return func(name, "r", fileobj, **kwargs)
  File "C:\Python33\lib\tarfile.py", line 1614, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "C:\Python33\lib\tarfile.py", line 1442, in __init__
    fileobj = bltn_open(name, self._mode)
FileNotFoundError: [Errno 2] No such file or directory: 'non-existing'

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20384>
_______________________________________


More information about the Python-bugs-list mailing list