PySnooper: pysnooper/tracer.py", line 75, in get_source_from_frame raise NotImplementedError

When I ran a simple script:

import pysnooper
import numpy as np

@pysnooper.snoop()
def multi_matmul(times):
    x = np.random.rand(2,2)
    w = np.random.rand(2,2)
    
    for i in range(times):
        x = np.matmul(x,w)
    return x

multi_matmul(3)

The error happened:

Starting var:.. times = 3
Traceback (most recent call last):
  File "<tmp 1>", line 14, in <module>
    multi_matmul(3)
  File "</usr/local/lib/python3.6/dist-packages/decorator.py:decorator-gen-121>", line 2, in multi_matmul
  File "/usr/local/lib/python3.6/dist-packages/pysnooper/pysnooper.py", line 72, in decorate
    return function(*args, **kwargs)
  File "<tmp 1>", line 4, in multi_matmul
    @pysnooper.snoop()
  File "/usr/local/lib/python3.6/dist-packages/pysnooper/tracer.py", line 182, in trace
    source_line = get_source_from_frame(frame)[frame.f_lineno - 1]
  File "/usr/local/lib/python3.6/dist-packages/pysnooper/tracer.py", line 75, in get_source_from_frame
    raise NotImplementedError
NotImplementedError

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Ah, I think I get it. Are you using PySnooper on code that you’re typing in the interactive shell?