line_profiler: what am I doing wrong?

Neal Becker ndbecker2 at gmail.com
Fri Feb 13 08:35:13 EST 2015


Robert Kern wrote:

> @profile
> def run():
> pass
> 
> run()

No, this doesn't work either.  Same failure

kernprof -l test_prof.py 
Wrote profile results to test_prof.py.lprof
Traceback (most recent call last):
  File "/home/nbecker/.local/bin/kernprof", line 9, in <module>
    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_prof.py", line 1, in <module>
    @profile
NameError: name 'profile' is not defined

-- 
-- Those who don't understand recursion are doomed to repeat it




More information about the Python-list mailing list