question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ResourceWarning: unclosed socket

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Issue

If i run python with warnings enabled (set the env var PYTHONWARNINGS="default" ), and try to do poetry update or any remote connection related operation i get the following message:

C:\Users\<username>\.poetry\lib\poetry\console\application.py:54: ResourceWarning: unclosed <ssl.SSLSocket fd=868, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('157.163.199.78', 57798), raddr=('151.101.192.223', 443)>
  self._poetry = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Poetry version 1.0.5 Python 3.8.2 x64 Windows 10

Update: added the fuller message with the location of the warning in code: C:\Users\<username>\.poetry\lib\poetry\console\application.py:54:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kbaikovcommented, Oct 15, 2021

The fix works for me with Poetry (version 1.2.0a2) and Python 3.10

0reactions
kbaikovcommented, Oct 15, 2021

Perfect, thank you. I will apply and test it locally in the evening.

On Fri, 15 Oct 2021, 13:11 Kevin Kirsche @.***> wrote:

PR submitted. If this is bugging you the patch locally is pretty simple also. ~8 or so lines.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/python-poetry/poetry/issues/2153#issuecomment-944214288, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCH53ZFTPDHDWMYHUYZPPLUHAD55ANCNFSM4LD4DOFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ResourceWarning unclosed socket in Python 3 Unit Test
I'm modifying some code to be compatible between Python 2 and Python 3 , but have observed a warning in unit test output....
Read more >
unclosed socket.socket when I run a unittest? · Issue #3912 ...
This warning happens because Requests uses a keep-alive model that means we try not to explicitly close sockets in many cases. Exactly why...
Read more >
ResourceWarning: unclosed <socket.socket [closed] fd=3 ...
_socket.socket object destructor emits a ResourceWarning if the socket is not closed. The problem is this warning: build/Lib/contextlib.py:60: ...
Read more >
[PYTHON-2338] _RttMonitor causes ResourceWarning
Noticed this ResourceWarning for an unclosed socket while running the tests. The ResourceWarning seem to randomly occur throughout the test ...
Read more >
ResourceWarning unclosed socket in Python 3 Unit Test
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py:601: ResourceWarning: unclosed socket.socket fd=4, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found