Skip to content

[Bug]: TypeError: Cannot instantiate typing.Any #227

Description

@nikitos

Steps to reproduce

in pw.io.http.rest_connector if no schema was provided default is:

schema = pw.schema_builder({"query": pw.column_definition()})

but deserialising is imposible to typing.Any here:
exact_type = unoptionalize(dtype).typehint

Relevant log output

ERROR:root:Failed to cast column 'query' to type 'typing.Any'
Traceback (most recent call last):
  File "/Users/nikitos/.pyenv/versions/pathway3/lib/python3.10/site-packages/pathway/io/http/_server.py", line 480, in _cast_types_to_schema
    payload[column] = exact_type(payload[column])
  File "/Users/nikitos/.pyenv/versions/3.10.19/lib/python3.10/typing.py", line 387, in __call__
    raise TypeError(f"Cannot instantiate {self!r}")
TypeError: Cannot instantiate typing.Any

What did you expect to happen?

i temporary use this hack, but not sure is it right: payload[column] = payload[column] if exact_type == typing.Any else exact_type(payload[column])

Version

0.30.1

Docker Versions (if used)

No response

OS

MacOS

On which CPU architecture did you run Pathway?

ARM64 (AArch64, Apple silicon)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions