This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Error when passing a file object to tarfile.open()
Type: crash Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: GeorgeNotaras, amaury.forgeotdarc
Priority: normal Keywords:

Created on 2007-11-30 21:16 by GeorgeNotaras, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg58011 - (view) Author: George Notaras (GeorgeNotaras) Date: 2007-11-30 21:16
Assume a healthy uncompressed tar file: a.tar

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

>>> 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'
msg58014 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-11-30 21:33
This problem was fixed in r57617.
Can you check with a more recent build?
msg58017 - (view) Author: George Notaras (GeorgeNotaras) Date: 2007-11-30 22:07
Indeed, I have downloaded the latest tarfile module from svn and it
works as expected. I should have done this in the first place.
msg58019 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2007-11-30 22:13
The fix is already included in the future 2.5.2 release.
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45870
2007-11-30 22:13:14amaury.forgeotdarcsetstatus: open -> closed
messages: + msg58019
2007-11-30 22:07:20GeorgeNotarassetmessages: + msg58017
2007-11-30 21:33:06amaury.forgeotdarcsetresolution: works for me
messages: + msg58014
nosy: + amaury.forgeotdarc
2007-11-30 21:16:52GeorgeNotarascreate