I'm trying to use the line_profiler
library to profile some Python code. However, when I run the command:
kernprof -l -v bots\main.py
I get the following error:
Traceback (most recent call last):
File "C:\Python34\Scripts\kernprof-script.py", line 9, in <module>
load_entry_point('line-profiler==1.0', 'console_scripts', 'kernprof')()
File "C:\Python34\lib\site-packages\kernprof.py", line 221, in main
execfile(script_file, ns, ns)
File "C:\Python34\lib\site-packages\kernprof.py", line 34, in execfile
exec_(compile(f.read(), filename, 'exec'), globals, locals)
File "bots\main.py", line 2, in <module>
from bots.scheduler import *
ImportError: No module named 'bots'
Clearly the line_profiler
isn't recognising the __init__.py
file I have in the directory /bots
(where all my scripts are). When I run main.py
normally it works fine. How can I get line_profiler
to acknowledge the __init__.py
module and behave appropriately?