I have a python project where I execute the app as a module using the -m
flag. So something like:
python -m apps.validate -i input.mp4
Now, I want to profile it using the command line. So the inline examples suggest invoking cProfile itself a module. However, I cannot do something like:
python -m cProfile apps.validate -i input.mp4
However, this results in the error "No such file or directory". I cannot just go to the apps
directory and launch validate.py
due to relative imports.
Is there a way to profile a module on the command line?