Re: retrieve source code from code object as returned by compile()

2014-04-25 Thread Amirouche Boubekki
in python3, I do inspect.getsource(object) [dochttps://docs.python.org/3/library/inspect.html#inspect.getsource], I don't know the limitations. On Python 2, there is meta https://pypi.python.org/pypi/meta. My interest is different, I use to retrieve the definition of function to submit it to a

Re: retrieve source code from code object as returned by compile()

2014-04-25 Thread Gregory Ewing
Amirouche Boubekki wrote: in python3, I do inspect.getsource(object) [doc https://docs.python.org/3/library/inspect.html#inspect.getsource], I don't know the limitations. The limitation relevant here is that it requires the original source file to be present. :-) -- Greg --

Re: retrieve source code from code object as returned by compile()

2014-04-24 Thread Justin Ezequiel
On Thursday, April 24, 2014 1:53:38 PM UTC+8, Gregory Ewing wrote: Alternatively you could create a .pyc file out of the code object and then use Easy Python Decompiler on that. The following snippet of code should do that: (Taken from:

retrieve source code from code object as returned by compile()

2014-04-23 Thread Justin Ezequiel
Is there a way to get the original source? I am trying to retrieve the main script from a py2exe'd old program. The programmer neglected to commit to SVN before leaving. Using Easy Python Decompiler I am able to get the source for the imported modules. Using Resources Viewer from PlexData and

Re: retrieve source code from code object as returned by compile()

2014-04-23 Thread Gregory Ewing
Justin Ezequiel wrote: Using Easy Python Decompiler I am able to get the source for the imported modules. Using Resources Viewer from PlexData and some code I am able to retrieve the code object. I am however stumped as to how to retrieve the source from this code object. Easy Python