AttributeError :__Enter__ error is throwed when using pyopenssl lib 20.01 version
See original GitHub issueWhen creating a secure websocket connection(wss) using websocket create_connection() api call in pyopenssl - openssl/ssl.py (20.0.1), AttributeError: enter error is thrown.
Complete error flow is given below :
line 514, in create_connection
websock.connect(url, **options)
line 226, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
line 76, in handshake
send(sock, header_str)
line 157, in send
return _send()
line 139, in _send
return sock.send(data)
line 1644, in send
with _from_buffer(buf) as data:
AttributeError: enter
Websocket call flow : websocket.create_connection() -> websock.connect->handshake() -> send(sock, header_str) -> sock.send(data)
Surprisingly, when using 19.1.0 of pyopenssl version, there was no such error observed.
Between these 2 versions, send() method in SSL.py file does not have any changes. surprised to see the error when i execute the test case after the update of library.
with _from_buffer(buf) as data:
if len(buf) > 2147483647:
raise ValueError("Cannot send more than 2**31-1 bytes at once.")
result = _lib.SSL_write(self._ssl, data, len(data))
self._raise_ssl_error(self._ssl, result)
return result
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
AttributeError: __enter__ in pyopenssl 20.0.1 - Stack Overflow
1), AttributeError: enter error is thrown. Error is pointing to "with statements available in send method of SSL.py file" whereas in 19.1.0 ...
Read more >Attribute :__Error__ thrown in pyopenssl lib 20.01 : r/learnpython
When creating a secure websocket connection(wss) using websocket create_connection() api call in pyopenssl - openssl/ssl.py (20.0.1), ...
Read more >The AttributeError: __enter__ Python Error Solved
So, the AttributeError: __enter__ is raised when using a with statement with a class that does not have the __enter__ method. Note, that...
Read more >AttributeError: module 'lib' has no attribute ... - GitHub
I've used the python:3.7.6-slim-stretch docker image for almost one year. Just today I got this strange issue (with pyOpenSSL==17.5.0): ...
Read more >openssl - module 'lib' has no attribute ... - Ask Ubuntu
Warning!!! if you are using pyOpenSSL==20.0.1 and find this error when building new container image. Upgrade to pyOpenSSL==22.0.0 could fix ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’ll need to update to
cffi >= 1.12
.@alex @tiran : Thanks for your feedback. The version cffi -->1.1 is not an explicit version mentioned in requirement.txt file in my py project. However, this version is getting installed due to dependent py module installation, i guess. @alex does cffi version 1.12 is handled to fix the AttributeError: Enter ?