Python Forum

Full Version: Recover currently running script?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a program that I used Notebook++ to write, and I did not back it up for the past two weeks even though I put a ton of work into it.  I ran the script using iPython in Powershell and then Notebook crashed and completely wiped out the original code.  The file name is saved with no lines of code in it.  I am a relatively new programmer who learned the hard way why backing up and GitHub are so important, but does anyone have any idea of a way that I can recover the code, especially since it is still running in iPython?   There must be a cache of it somewhere or a magic function that will show the code that is in memory?  Any help would be incredibly appreciated!
you mean notepad++ right?

hopefully you've learned a valuable lesson. i think you'd have better luck reaching out on an iPython forum, maybe a copy of it is made somewhere along the line. Maybe notepad++ has it cached somewhere but i would have no clue, better to ask on a notepad++ forum heh. good luck!
what happens if you type object_name?
(include the ?)

I would take a look at what's available in inspect (needs to be imported) in addition, ipython has some builtin commands that may be of help.
Sorry that I don't have specifics, but it's something. It seems that you might find some way to inspect your namespace.
Not sure which version of Windows you're using, but in Windows 10, Notepad++ will keep a backup file that it is working on in the C:\Users\user_name \AppData\Roaming\Notepadd++\backup. It might have a name like:
file_name.py@2016-12-07_084239. If your lucky, it might still be there.