tarfile module crash: Anyone else having this problem?

I am still plugging away at my python script installer/manager (http://blenderartists.org/forum/showthread.php?t=81748), but came across an interesting problem using the tarfile module. If tarfile.is_tarfile() or tarfile.open() is given an invalid tar file, Blender crashes.

I submitted a bug report here:
http://projects.blender.org/tracker/?func=detail&aid=5668&group_id=9&atid=125
even though I’m not really sure that this is Blender’s fault.

My question is, does the following script crash Blender for anyone besides me?

import tarfile
print tarfile.is_tarfile("blender.html")

If not, maybe the problem is just mine and I can go ahead and keep on using is_tarfile(), and just refrain from loading invalid tar files in my tests. Otherwise, it’d be nice to have help or a second opinion in resolving this issue.

Thanks!
Levi

does it crash if running in vanilla python?

Nope. That’s the strange part. I’m assuming that it doesn’t crash for you, either. Are you on Windows?

Edit: It appears that it’s not the tarfile module at all, but rather the bz2 module. The following is what blows up for me:

import bz2
f = bz2.BZ2File("blender.html")
print f.read() # Crash!

Levi

No help from me, just confirming the crash on:
Windows XP, blender 2.42a win 32 dynamic, python 2.4
Windows XP, blender cvs 21-12-2006 win32 dynamic, python 2.4

Following commands crash:
next()
read()
readline()
readlines()
seek()
Following do work:
close()
closed
mode
name
newlines
softspace
tell()
xreadlines() [no idea what the parameters should be, but it doesn’t crash]

Your first post about .is_tarfile() does crash as well.

Thanks Crouch! I was hoping it wasn’t just me. Then again, that means I’ll need to find a hack to get around it. Rats.

The reason the is_tarfile() and tarfile.open() crashes is because it tries to open the file using all three compression settings (raw, gzipped, and bz2). When it tries bz2 on a non-bz2 file … crash!

Levi