tags:

views:

210

answers:

1

Hi, I have been using a flash card program called Mnemosyne which uses python script. A short time ago my database of flash cards became inaccessible after my computer froze and I had to shut it down manually. Whenever I try to load the data base containing my cards I get this error.

Invalid file format 
Traceback(innermost last): 
File "mnemosyne\core\mnemosyne_core.pyc", line 1012, in load_database 
BadPickleGet: 577"

Help would be greatly appreciated.

+1  A: 

(Whilst CLayton's copy may be a binary distribution, the source to mnemosyne is freely available.)

It's not much help though: line 1012 is just:

db = cPickle.load(infile)

Where ‘infile’ is the stored database file. So there's something corrupt in your database file. (BadPickleGet is a specific subclass of UnpicklingError, which is what you expect when the input is broken.)

You could maybe change mnemosyne_core.py to use the plain Python pickle module instead of cPickle, allowing you to add debugging to pickle.py and work out exactly what it is in the file it doesn't like. But to be honest, if the file became corrupt due to a hardware fault/hard power down the chances are the contents are either truncated, unreadable or just total garbage.

Prepare to be going through those early cards all over again...

bobince
Oh well, thanks for the help though, is there any best method of extracting the cards by hand? The script can be a bit difficult to go through and I would like to take out 800 cards in particular belonging to one category, so any method of sifting through the python script would be very helpful
You could try examining the data with pickletools.dis(). If you have truncated data this will at least show you how much you've got. I suspect you may have lost the lot though.
bobince