pyinstrument icon indicating copy to clipboard operation
pyinstrument copied to clipboard

[bug] pyinstruments not working TypeError: 'NoneType' object is not callable

Open PabloRuizCuevas opened this issue 1 year ago • 1 comments

I found a bug that pyinstrument not to work at all, I think it may be related with my logger configuration, but I'm not sure. this is the error:

Traceback (most recent call last):
  File "C:\Users\PabloRuiz\AppData\Local\Programs\Python\Python311\Lib\logging\__init__.py", line 845, in _removeHandlerRef
  File "C:\Users\PabloRuiz\AppData\Local\Programs\Python\Python311\Lib\logging\__init__.py", line 845, in _removeHandlerRef
  File "C:\Users\PabloRuiz\AppData\Local\pypoetry\Cache\virtualenvs\transformer-wi-nHELc-py3.11\Lib\site-packages\pyinstrument\stack_sampler.py", line 134, in _sample
  File "C:\Users\PabloRuiz\AppData\Local\pypoetry\Cache\virtualenvs\transformer-wi-nHELc-py3.11\Lib\site-packages\pyinstrument\stack_sampler.py", line 148, in _timer
TypeError: 'NoneType' object is not callable

PabloRuizCuevas avatar Mar 19 '24 08:03 PabloRuizCuevas

Sorry for the delay, but I'll need a recreation to really work on this.

joerick avatar Aug 26 '24 13:08 joerick

Please feel free to reopen if you manage to find a recreation!

joerick avatar May 24 '25 16:05 joerick

I hit this recently and I don't have a way to reproduce it, but I'll mention that it only happened when I started and stopped profiling using the Profiler() start() and stop() methods. I worked around the problem by starting profiling through running pyinstrument from the command line instead.

rtkefreure avatar May 26 '25 13:05 rtkefreure