[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Loading files from .tar



In order to make the game more presentable to the user, I have this idea on putting all the resources on a .tar file (and further compiling everything in a single .exe)
Using then the tar library that comes with python, I extract the file and then pass as arguments on the methods that loads the resources, such as images, fonts and etc.

Doing this for images worked just fine (didn't tried for sounds yet), but I got the following error when I tried to do this for a font file:

Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information. 

This is the code that don't work:

tar = tarfile.open("data.dat")
self.realtimeInfo = font.Font(tar.extractfile("bankgthl.ttf"), 16)

But this work well:

tar = tarfile.open("data.dat")
extractedImage = tar.extractfile("background.png")
self.background = "">

I think that I may have passed the arguments wrong, but also not sure how it work to make it right. The library was imported, as I said, the image function work
Anyone has tried this before?