Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class_name.py throws TypeError #82

Closed
jorritsma opened this issue Dec 8, 2023 · 4 comments
Closed

class_name.py throws TypeError #82

jorritsma opened this issue Dec 8, 2023 · 4 comments

Comments

@jorritsma
Copy link

Hi,

Interesting library! I am a newby and tried a hello-world app, with the default code. I run the code in a Docker container on Python 3.9. I get this TypeError:

File "/usr/local/lib/python3.9/site-packages/fastui/class_name.py", line 6, in
ClassName = Annotated[str | list[str] | dict[str, bool | None] | None, Field(serialization_alias='className')]
TypeError: unsupported operand type(s) for |: 'type' and 'types.GenericAlias'

Any suggestions?

Kind regards, Harmen

@hasansezertasan
Copy link
Contributor

hasansezertasan commented Dec 8, 2023

It's an incompatibility issue with the new syntax for Union. I believe | operand doesn't work on 3.9, it's fixed in #66

Solutions:

  • Upgrade your python version
  • Install the package using git (something like pip install https://github.com/pydantic/FastUI)
  • Wait for the next release.

@jorritsma
Copy link
Author

Thanks. I tried running fastUI with Python 3.10 instead of 3.9 and I tried with the latest fastUI via github. Both doesn't solve the TypeError. I will wait for the next release.

@samuelcolvin
Copy link
Member

I'll do a release soon, to use the current release, you need 3.11.

@samuelcolvin
Copy link
Member

this is fixed since I released v0.3.0 yeseterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants