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

TypeError: 'VPC' object does not support the context manager protocol #946

Open
ruckc opened this issue Nov 8, 2023 · 2 comments
Open

Comments

@ruckc
Copy link

ruckc commented Nov 8, 2023

With this code:

from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.network import PublicSubnet, PrivateSubnet, VPC


with Diagram("diagram"):
    with VPC("vpc"):
        with PublicSubnet('1a'):
            EC2('bastion')

I get this error message when executing it python test.py

Traceback (most recent call last):
  File "/home/user/test.py", line 7, in <module>
    with VPC("vpc"):
TypeError: 'VPC' object does not support the context manager protocol

Not sure what i'm doing wrong.

I get this on Python 3.12 and 3.11. With Python 3.10 and 3.9 I get

Traceback (most recent call last):
  File "/home/user/test.py", line 7, in <module>
    with VPC("vpc"):
AttributeError: __enter__
@Anddd7
Copy link

Anddd7 commented Dec 12, 2023

The Cluster and Node are different source in graphviz. So it cannot put a VPC(Node) as a Cluster. I think there are bunch of PRs making it possible (#823). But the author is inactive so all those are pending ...

@Anddd7
Copy link

Anddd7 commented Dec 13, 2023

I create a fork to use it as a local dependency, you can check Anddd7#1. Make a copy by your self or use my main branch.

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

2 participants