[Tutor] Anyone using tarfile?
carroll at tjc.com
Tue Jul 15 19:31:56 CEST 2008
On Tue, 15 Jul 2008, Kent Johnson wrote:
> What version of Python are you using? I have 2.5.2 and the line
> numbers in my tarfile.py are quite different than yours. The changelog
> for Python 2.5.2 shows many fixes to tarfile so an upgrade may be in
And that was it! I pulled the most current version from
http://svn.python.org/view/python/trunk/Lib/tarfile.py , saved it as
"tarfilex.py" and used "import tarfilex as tarfile", and it's now working.
You know how sometimes when you're a newbie, every time you get an
unexpected result, you jump to "there must be a bug in the program I'm
using"? Well, I've been programming long enough that I tend to assume the
opposite: "I must be doing something wrong."
> My version of the source picks up a prefix string and adds it to the
> start of the path unless the file is a "GNU sparse" file.
I saw that too, but it still struck me as odd. For one thing, I don't
understand where sparseness of the tar file (which has to do with whether
tar bothers storing all of "sparse" files -- files that have data space
allocated but not initialized) would have anything to do with a file name.
That's one of the things that led to my "the deeper I look into this, the
more mystified I become" comment.
For another thing, "prefix" still isn't documented; I'd have expected the
variable name to be along the lines of _prefix, or not retained in the
class instance if it wasn't intended for consumption. But that might just
be my naivete.
Anyway, problem solved. Thanks, Kent.
More information about the Tutor