Francesc Altet wrote:

El dc 08 de 03 del 2006 a les 09:17 -0800, en/na Andrew Straw va
escriure:
Hi,

I looks like I may have lost the results of last nights' experiments by
doing a Ctrl-C to quit my Python program writing hdf5 files using
pytables rather than doing it nicely. :( Obviously, this is something I
won't do again in the future, but do I have any hope to rescue my hdf5
file? I presume it's only the last few rows in the tables that are
causing a problem, but even tools like h5ls don't work:

Ooops! I'd like to be wrong, but if the file has got corrupted, I'm
afraid that you will not be able to retrieve your data anymore :-(

The situation is similar to switch off a filesystem without properly
unmounting it, with the additional burden that there are not, to my
knowledge, a repairing tool for corrupted HDF5 files. Right now, the
best technique to not loose many data when working with HDF5 files is to
take a defensive approach and create backup files from time to time.

I know that somebody in this list was also worried by these kind of
issues, and perhaps he can say more on this.

Well, I've implemented an exit function using the atexit.register() function to properly close the file, at least where possible. I suspect this would have saved me from my rather careless action, but I don't plan on depending on this in the future -- I hope this will be a last-resort feature of my code rather than a heavily-depended upon feature. :)

Anyhow, perhaps pytables could do something similar internally -- maintain a list of open files and register its own exit function with atexit.register() to make sure this sort of thing could be prevented in the future? It won't prevent against all unexpected program closes (e.g. signals) but my preliminary tests shows it does get called with ctrl-c. It should only be a few lines of code.

Cheers!
Andrew


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to