0

I want to profile a module that takes arguments with -- . cProfile then thinks that these are arguments for themselves. How can I work around this?

py -3.9 -m cProfile -m my_module -o statistics --my-argument
Usage: cProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...

cProfile.py: error: no such option: --my-argument
Fire Cube
  • 15
  • 4

1 Answers1

0

Just change the order. It should work.

py -3.9 -m cProfile -o statistics.prof -m my_module <args>

If it is not a module then:

py -3.9 -m cProfile -o statistics.prof your_code.py <args>
William
  • 464
  • 2
  • 16