[New-bugs-announce] [issue1529] Error when passing a file object to tarfile.open()

George Notaras report at bugs.python.org
Fri Nov 30 22:16:52 CET 2007

New submission from George Notaras:

Assume a healthy uncompressed tar file: a.tar

When trying to open the tarfile using a fileobject, there is always an

>>> f_raw = open("a.tar", "rb")
>>> import tarfile
>>> f_tar = tarfile.open(mode="r:", fileobj=f_raw)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/tarfile.py", line 1157, in open
    return func(name, filemode, fileobj)
  File "/usr/lib/python2.5/tarfile.py", line 1183, in taropen
    return cls(name, mode, fileobj)
  File "/usr/lib/python2.5/tarfile.py", line 1047, in __init__
    self.name = os.path.abspath(name)
  File "/usr/lib/python2.5/posixpath.py", line 402, in abspath
    if not isabs(path):
  File "/usr/lib/python2.5/posixpath.py", line 49, in isabs
    return s.startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'

components: Extension Modules
messages: 58011
nosy: GeorgeNotaras
severity: normal
status: open
title: Error when passing a file object to tarfile.open()
type: crash
versions: Python 2.5

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list