Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'skip:" 60': 0.07; 'inserted': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; 'wrote': 0.14; 'nameerror:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'written': 0.21; 'header :User-Agent:1': 0.23; 'received:comcast.net': 0.24; 'skip:l 30': 0.24; 'skip:" 30': 0.26; 'defined': 0.27; 'skip:" 20': 0.27; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; "skip:' 10": 0.31; 'subject:what': 0.31; 'file': 0.32; '(most': 0.33; 'something': 0.35; 'subject:?': 0.36; 'wrong': 0.37; 'received:76': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'recent': 0.39; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'even': 0.60; 'profile': 0.61; 'name': 0.63; 'results': 0.69; 'subject:skip:l 10': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Neal Becker Subject: line_profiler: what am I doing wrong? Date: Tue, 10 Feb 2015 19:06:34 -0500 Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: c-76-100-246-88.hsd1.md.comcast.net User-Agent: KNode/4.14.3 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423613207 news.xs4all.nl 2867 [2001:888:2000:d::a6]:45781 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85488 I inserted @profile def run(...) into a module-level global function called 'run'. Something is very wrong here. 1. profile results were written before anything even ran 2. profile is not defined? kernprof -l ./test_unframed.py --lots --of --args ... Wrote profile results to test_unframed.py.lprof Traceback (most recent call last): File "/home/nbecker/.local/bin/kernprof", line 9, in load_entry_point('line-profiler==1.0', 'console_scripts', 'kernprof')() File "/home/nbecker/.local/lib/python2.7/site-packages/kernprof.py", line 221, in main execfile(script_file, ns, ns) File "./test_unframed.py", line 721, in @profile NameError: name 'profile' is not defined