Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost important .py file (overwritten as 0byte file), but the old version still LOADED IN IPYTHON as module -- can it be retrieved?

Tags:

People also ask

Can you convert pyc to py?

Yes, it is possible. Decompyle++ aims to translate compiled Python byte-code back into valid and human-readable Python source code.

How do I edit a PYC file?

You cannot edit pyc files. A . pyc file is a compiled version of a . py file.


While managing several different screen sessions with vim open in many of them, in the process of trying to "organize" my sessions I somehow managed to overwrite a very important .py script with a 0Byte file.

However, I have an ipython instance open that, when running that same .py file as a module, still remembers the code that used to be there!

So did I just learn a hard lesson about backups (my last one was done by vim about a week ago, which would leave me with a lot of work to do), or is there any possible, conceivable way to retrieve the .py file from an already loaded module? I probably deserve this for being so cavalier, but I'm seriously desperate here.