Skip to content

Undeclared variable "attribute_type" #672

@jonathan-rowley

Description

@jonathan-rowley

I ran into an issue testing with Jina/DocArray and found a variable that is not declared.

Here is the error:

ERROR  weaviate/rep-0@67192 UnboundLocalError("local variable 'attribute_type' referenced before assignment")    [10/24/22 16:49:34]
        add "--quiet-error" to suppress the exception details
       Traceback (most recent call last):
         File ".local/lib/python3.8/site-packages/jina/serve/runtimes/worker/__init__.py", line
       182, in process_data
           result = await self._data_request_handler.handle(requests=requests)
         File
       ".local/lib/python3.8/site-packages/jina/serve/runtimes/request_handlers/data_request_han…
       line 164, in handle
           return_data = await self._executor.__acall__(
         File ".local/lib/python3.8/site-packages/jina/serve/executors/__init__.py", line 291, in
       __acall__
           return await self.__acall_endpoint__(req_endpoint, **kwargs)
         File ".local/lib/python3.8/site-packages/jina/serve/executors/__init__.py", line 314, in
       __acall_endpoint__
           return func(self, **kwargs)
         File ".local/lib/python3.8/site-packages/jina/serve/executors/decorators.py", line 162,
       in arg_wrapper
           return fn(executor_instance, *args, **kwargs)
         File "test_executor.py", line
       193, in index
           return DocumentArray(Document(dc.Video(
         File ".local/lib/python3.8/site-packages/docarray/document/__init__.py", line 147, in
       __init__
           super().__init__(*args, **kwargs)
         File ".local/lib/python3.8/site-packages/docarray/base.py", line 38, in __init__
           self._data = type(self)._from_dataclass(_obj)._data
         File ".local/lib/python3.8/site-packages/docarray/document/mixins/multimodal.py", line
       86, in _from_dataclass
           doc, attribute_type = cls._from_obj(attribute, field.type, field)
         File ".local/lib/python3.8/site-packages/docarray/document/mixins/multimodal.py", line
       164, in _from_obj
           doc = cls(obj)
         File ".local/lib/python3.8/site-packages/docarray/document/__init__.py", line 147, in
       __init__
           super().__init__(*args, **kwargs)
         File ".local/lib/python3.8/site-packages/docarray/base.py", line 38, in __init__
           self._data = type(self)._from_dataclass(_obj)._data
         File ".local/lib/python3.8/site-packages/docarray/document/mixins/multimodal.py", line
       76, in _from_dataclass
           'attribute_type': attribute_type,
       UnboundLocalError: local variable 'attribute_type' referenced before assignment

I looked at the file .local/lib/python3.8/site-packages/docarray/document/mixins/multimodal.py and found on line 76 that it was not defined.

image

Im not sure what the default value should be.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions