I am new here, so sorry for any mistakes. I am using spyder 3.0.0 and iPython console.
I have mistakenly overwritten my custom module file. My last hope is that I have loaded it in iPython console. Is there any way to get the source code "back" from the console?
The console lists all the names (of my overwritten module) after calling dir (modulename)
, it also creates objects and hint arguments for objects' methods.
I have tried (after importing inspect) print(inspect.getsource(MyClass))
, but it throws
File "C:\Users\witek\Anaconda3\lib\inspect.py", line 613, in getfile
raise TypeError('{!r} is a built-in class'.format(object))
TypeError: <module '__main__'> is a built-in class
If I call print(inspect.getsource(MyModule))
it returns the source code of the file that I saved under my module name.
I will really appreciate any help! :)