Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70605
| References | <4dfca89b-82c6-42f4-aedb-2fe82a7f7dc1@googlegroups.com> <brrn75Fh59nU1@mid.individual.net> <3abe4779-a237-4113-aaf0-24990895151f@googlegroups.com> |
|---|---|
| From | Amirouche Boubekki <amirouche.boubekki@gmail.com> |
| Date | 2014-04-25 18:34 +0200 |
| Subject | Re: retrieve source code from code object as returned by compile() |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.9501.1398447453.18130.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
in python3, I do inspect.getsource(object) [doc<https://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 database, instead of stored procedures, but I have the source of the code. It can also be used to retrieve the ast. 2014-04-25 4:50 GMT+02:00 Justin Ezequiel <justin.ezequiel@gmail.com>: > 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: > > > > http://stackoverflow.com/questions/8627835/generate-pyc-from-python-ast) > > Woohoo! Success! Thank you Greg! > -- > https://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
retrieve source code from code object as returned by compile() Justin Ezequiel <justin.ezequiel@gmail.com> - 2014-04-23 17:58 -0700
Re: retrieve source code from code object as returned by compile() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-24 17:53 +1200
Re: retrieve source code from code object as returned by compile() Justin Ezequiel <justin.ezequiel@gmail.com> - 2014-04-24 19:50 -0700
Re: retrieve source code from code object as returned by compile() Amirouche Boubekki <amirouche.boubekki@gmail.com> - 2014-04-25 18:34 +0200
Re: retrieve source code from code object as returned by compile() Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-04-26 12:03 +1200
csiph-web