Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url:pypi': 0.03; 'subject:code': 0.07; 'snippet': 0.09; 'subject:()': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'stored': 0.12; '<>.': 0.14; '(taken': 0.16; '24,': 0.16; 'different,': 0.16; 'justin': 0.16; 'subject:object': 0.16; 'url:meta': 0.16; 'thursday,': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'source': 0.25; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'database,': 0.30; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'that.': 0.31; 'file': 0.32; 'url:python': 0.33; 'subject:from': 0.34; 'could': 0.34; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'thank': 0.38; 'url:library': 0.38; 'url:mail': 0.40; 'easy': 0.60; 'url:3': 0.61; 'interest': 0.64; 'to:addr:gmail.com': 0.65; 'subject:source': 0.84; 'success!': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=zVT7qE2C4D54LL2ZYseBCWhmcPJCT2WJBJPMWYNlwCQ=; b=Kb16xBM7Dn0aoYwi07Zlc3U6n0gQlFiqJp5YMUJ0aw/rhi9MbCYx1ss2fuFblKV9vo wjhtvSn28EUTDrctTv3FcY/a41shusFab7qffBbEamw2rKpBJ4NORRKUbWdImFkzu4E0 JPEjHY3HK9zQArEXeAaVHcCtyh4Py57mKYnD9ZH77PnEquMmJkzZDeCdobAsPu9rzos4 3ZyNefdB+tMNGOJ0WXruW7VUnTY8DV750BLfsCoFgiLELjSKzWuuJOgfwCLjQuheApC6 zL5nl5LRigltYaaOwJ22ODyKbu/Uh0tD3Tf/Y/zrmY7yod3aSakvU7QoewZVzM8GrDja CfHA== X-Received: by 10.236.135.197 with SMTP id u45mr3869160yhi.150.1398443719742; Fri, 25 Apr 2014 09:35:19 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <3abe4779-a237-4113-aaf0-24990895151f@googlegroups.com> References: <4dfca89b-82c6-42f4-aedb-2fe82a7f7dc1@googlegroups.com> <3abe4779-a237-4113-aaf0-24990895151f@googlegroups.com> From: Amirouche Boubekki Date: Fri, 25 Apr 2014 18:34:59 +0200 Subject: Re: retrieve source code from code object as returned by compile() To: Justin Ezequiel Content-Type: multipart/alternative; boundary=20cf3011db9d275d5d04f7e08d98 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398447453 news.xs4all.nl 2850 [2001:888:2000:d::a6]:38988 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70605 --20cf3011db9d275d5d04f7e08d98 Content-Type: text/plain; charset=UTF-8 in python3, I do inspect.getsource(object) [doc], I don't know the limitations. On Python 2, there is 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 : > 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 > --20cf3011db9d275d5d04f7e08d98 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
in python3, I do inspect.getsource(object) [do= c], I don't know the limitations.

On Python 2, there i= s meta.

My interest is different, I use to retrieve the definition of fun= ction 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

--20cf3011db9d275d5d04f7e08d98--