Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'lines,': 0.07; 'subject:module': 0.09; 'def': 0.12; "'__doc__',": 0.16; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'source': 0.25; 'skip:" 20': 0.27; 'raise': 0.29; 'code': 0.31; "skip:' 10": 0.31; '"",': 0.31; 'inspect': 0.31; 'file': 0.32; '(most': 0.33; 'subject:the': 0.34; 'could': 0.34; 'subject:with': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'subject:get': 0.81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=vKO7RDAlD7WYhiRImR4g7c6U0r5C8I+TYdemBjaR89A=; b=xacpk5tS/oUr/K9124XM8JuFuUs2waQDi0QG5t+mxI1lI7PH3/oC1EZ1AQvK9r4ab4 Dcj7d/l9HKbChN26VGMDo1cjZy28FBoeblcn+YYRypiD8wdWTqM2SqWNCRFJQnOyWT1Z BUzA+gpiZvTaOA5MdpXx5r/+qXmlxVYE/aV+WKA+hXfygCEVRjGwjSTIS/KTTDMmcR1U RoXJLIgcidJ6+LqeVePGTHhZud6LYU4UID0iMWnZbOXugvjsAQNkoPiL8f5rSUuSv+5m 5zQoqXTeTNiSy8kAz5LZwKdB8So+H3l+wK78Fdq/UO3Avw8PgLKOpuCQXpfhSsuhxF8h KbFg== X-Received: by 10.70.62.5 with SMTP id u5mr55460861pdr.100.1408503947079; Tue, 19 Aug 2014 20:05:47 -0700 (PDT) Date: Wed, 20 Aug 2014 11:05:26 +0800 From: luofeiyu User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: python-list@python.org Subject: why i can't get the sourcecode with inspect module? Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408503952 news.xs4all.nl 2831 [2001:888:2000:d::a6]:49643 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76630 >>> import inspect >>> def changer(x,y): ... return(x+y) ... >>> dir() ['__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__ 'changer', 'inspect'] >>> inspect.getsource(changer) Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\inspect.py", line 830, in getsource lines, lnum = getsourcelines(object) File "D:\Python34\lib\inspect.py", line 819, in getsourcelines lines, lnum = findsource(object) File "D:\Python34\lib\inspect.py", line 667, in findsource raise OSError('could not get source code') OSError: could not get source code >>>