When I try to run python -m cProfile -o output.prof main.py
in the commandline I get the following error :
Can't get attribute 'myclass' on <module 'cProfile' from 'path_to_cProfile.py'
And it says that it is related to a line in code where I use pickle to load an object of class 'myclass' data = pickle.load(myfile)
However, when I use directly in the main.py :
pr = cProfile.Profile()
pr.enable()
main()
pr.disable()
pr.dump_stats("stats.prof")
it seems to work normally.
Any idea ?
Thanks