line_profiler
line_profiler copied to clipboard
How to use kernprof on module?
Hi,
I try to analyze my module but when i launch kernprof, I have the following error:
ValueError: Attempted relative import in non-package
I try several method to launch kernprof:
-
kernprof -l -v mymodule.__main__
the error is:IOError: [Errno 2] No such file or directory: mymodule.__main__
-
kernprof -l -v mymodule/__main__.py
the error is:ValueError: Attempted relative import in non-package
Normally i use the following command to launch my script:
python -m mymodule.__main__
Thank you very much
Here's a workaround: https://github.com/rkern/line_profiler/issues/8 You can change the pythonpath and then it should work.