Topic: Baffling tarfile.is_tarfile behaviour
I am getting some very odd behaviour in one of my python scripts...
I have a tar.bz2 file which, in my script is not being recognised ie
tarfile.is_tarfile(myfilepath)is returning False.
The file definitely exists and is a valid file. The bizarre thing is that when I test that file in both a standalone script and running python from the commandline, is_tarfile returns True (as it should).
I really don't know what could be causing it to return False in my main script - can anyone offer any ideas on why it's misbehaving or thoughts on things I could investigate (or point out to me the obvious thing I'm missing if that's the case)?
Details (in case important):
I am using Python 2.7 on a Centos 5 machine.
I am running in a chroot jail entered using os.chroot() but my standalone test works fine both with and without the chroot command.
Nothing is wrong with the variable holding the filepath - os.path.exists(myfilepath) returns True.
I haven't modified tarfile in any way.
tarfile.is_tarfile is working fine for other (not tar.bz2) tar files .