scanner-research / scanner

Efficient video analysis at scale
https://scanner-research.github.io/
Apache License 2.0
615 stars 108 forks source link

NameError: free variable 'param' referenced before assignment in enclosing scope #215

Closed willcrichton closed 5 years ago

willcrichton commented 6 years ago
import scannerpy
from scannerpy import FrameType
db = scannerpy.Database()
@scannerpy.register_python_op()
def foobar(x: FrameType) -> bytes: pass

Raises error

Traceback (most recent call last):
  File "/tmp/test.py", line 5, in <module>
    def foobar(x: FrameType) -> bytes: pass
  File "/home/will/.local/lib/python3.5/site-packages/scannerpy/op.py", line 350, in dec
    column_type = parse_annotation_to_column_type(typ)
  File "/home/will/.local/lib/python3.5/site-packages/scannerpy/op.py", line 282, in parse_annotation_to_column_type
    if typ == param.empty:
NameError: free variable 'param' referenced before assignment in enclosing scope

https://github.com/scanner-research/scanner/blob/master/python/scannerpy/op.py#L282