line_profiler icon indicating copy to clipboard operation
line_profiler copied to clipboard

Make module profiling easier

Open letmaik opened this issue 11 years ago • 1 comments

I want to run kernprof from the root of my package source like kernprof -l mylib\test\test.py -v but then any import within test.py fails, e.g. import mylib.foo because the current working dir is not added to the python path when running kernprof, which in my opinion should happen by default. The workaround is to temporarily hack sys.path within this specific module, but that's annoying.

letmaik avatar Nov 12 '14 21:11 letmaik

I'm using the same workaround, but would this simpler command-line trick work?

PYTHONPATH=$PWD:$PYTHONPATH kernprof -lv mylib\test\test.py

1fish2 avatar Mar 24 '18 05:03 1fish2