line_profiler: what am I doing wrong?

Robert Kern robert.kern at gmail.com
Mon Feb 16 06:06:19 EST 2015


On 2015-02-13 13:35, Neal Becker wrote:
> 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

Ah, do you have the package `future` installed?

https://github.com/rkern/line_profiler/issues/12

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list