mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
39.86k stars 2.55k forks source link

TypeError: unsupported operand type(s) for |: 'type' and 'types.GenericAlias' #1049

Open DucNgn opened 3 weeks ago

DucNgn commented 3 weeks ago

I'm encountering an error while trying to follow the quick start guide for the library. The error occurs when importing the Diagram class from the diagrams module.

Steps to Reproduce

  1. Install Graphviz (already done)
  2. Install diagrams using poetry: poetry add diagrams
  3. Create a Python file with the following content:
    from diagrams import Cluster, Diagram
  4. Run the python file: poetry run python3 main.py
Traceback (most recent call last):
  File "/Users/duc.nguyen/docs/main.py", line 1, in <module>
    from diagrams import Cluster, Diagram
  File "/Users/duc.nguyen/docs/.venv/lib/python3.9/site-packages/diagrams/__init__.py", line 40, in <module>
    class Diagram:
  File "/Users/duc.nguyen/docs/.venv/lib/python3.9/site-packages/diagrams/__init__.py", line 85, in Diagram
    outformat: str | list[str] = "png",
TypeError: unsupported operand type(s) for |: 'type' and 'types.GenericAlias'
mingrammer commented 3 weeks ago

Sorry, I fixed this issue with https://github.com/mingrammer/diagrams/pull/1052, and will release a new fixed version.

mingrammer commented 3 weeks ago

The fixed version (v0.24.1) is now released.