Title: Sample code causes Windows OSError #10038 · Issue #917 · python-zeroconf/python-zeroconf · GitHub
Open Graph Title: Sample code causes Windows OSError #10038 · Issue #917 · python-zeroconf/python-zeroconf
X Title: Sample code causes Windows OSError #10038 · Issue #917 · python-zeroconf/python-zeroconf
Description: Code from the README: from zeroconf import ServiceBrowser, Zeroconf class MyListener: def remove_service(self, zeroconf, type, name): print("Service %s removed" % (name,)) def add_service(self, zeroconf, type, name): info = zeroconf.get_...
Open Graph Description: Code from the README: from zeroconf import ServiceBrowser, Zeroconf class MyListener: def remove_service(self, zeroconf, type, name): print("Service %s removed" % (name,)) def add_service(self, zer...
X Description: Code from the README: from zeroconf import ServiceBrowser, Zeroconf class MyListener: def remove_service(self, zeroconf, type, name): print("Service %s removed" % (name,)) def add_service...
Opengraph URL: https://github.com/python-zeroconf/python-zeroconf/issues/917
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sample code causes Windows OSError #10038","articleBody":"Code from the README: \r\n\r\n```python\r\nfrom zeroconf import ServiceBrowser, Zeroconf\r\n\r\nclass MyListener:\r\n\r\n def remove_service(self, zeroconf, type, name):\r\n print(\"Service %s removed\" % (name,))\r\n\r\n def add_service(self, zeroconf, type, name):\r\n info = zeroconf.get_service_info(type, name)\r\n print(\"Service %s added, service info: %s\" % (name, info))\r\n\r\nzeroconf = Zeroconf()\r\nlistener = MyListener()\r\nbrowser = ServiceBrowser(zeroconf, \"_http._tcp.local.\", listener)\r\n\r\ntry:\r\n input(\"Press enter to exit...\\n\\n\")\r\nfinally:\r\n zeroconf.close()\r\n```\r\n\r\nCauses this error on Windows:\r\n\r\n```\r\nException in callback _ProactorBasePipeTransport._call_connection_lost(None)\r\nhandle: \u003cHandle _ProactorBasePipeTransport._call_connection_lost(None)\u003e\r\nTraceback (most recent call last):\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\events.py\", line 80, in _run\r\n self._context.run(self._callback, *self._args)\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\proactor_events.py\", line 162, in _call_connection_lost\r\n self._sock.shutdown(socket.SHUT_RDWR)\r\nOSError: [WinError 10038] An operation was attempted on something that is not a socket\r\nException in callback _ProactorBasePipeTransport._call_connection_lost(None)\r\nhandle: \u003cHandle _ProactorBasePipeTransport._call_connection_lost(None)\u003e\r\nTraceback (most recent call last):\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\events.py\", line 80, in _run\r\n self._context.run(self._callback, *self._args)\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\proactor_events.py\", line 162, in _call_connection_lost\r\n self._sock.shutdown(socket.SHUT_RDWR)\r\nOSError: [WinError 10038] An operation was attempted on something that is not a socket\r\nException in callback _ProactorBasePipeTransport._call_connection_lost(None)\r\nhandle: \u003cHandle _ProactorBasePipeTransport._call_connection_lost(None)\u003e\r\nTraceback (most recent call last):\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\events.py\", line 80, in _run\r\n self._context.run(self._callback, *self._args)\r\n File \"C:\\Program Files\\Python39\\lib\\asyncio\\proactor_events.py\", line 162, in _call_connection_lost\r\n self._sock.shutdown(socket.SHUT_RDWR)\r\nOSError: [WinError 10038] An operation was attempted on something that is not a socket\r\n```\r\n\r\nOn Python 3.9.3. \r\n\r\nIs there a way to shut down this library cleanly?","author":{"url":"https://github.com/ahrbe1","@type":"Person","name":"ahrbe1"},"datePublished":"2021-07-18T20:18:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":22},"url":"https://github.com/917/python-zeroconf/issues/917"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1bc6f639-57e7-f507-97b5-1b660f5b318c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DE2E:120B97:253EC6D:2F95FEB:6991A74C |
| html-safe-nonce | 7721481ecdbb240338322c3e23770f6842ca372cbb02029adae627cc545efa48 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTJFOjEyMEI5NzoyNTNFQzZEOjJGOTVGRUI6Njk5MUE3NEMiLCJ2aXNpdG9yX2lkIjoiMjQzMTM1MzM0NTYyNzIzNjE3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7e6ade8b9777f35b9caa73c8f2a425a48f3f2fa23786cef57ec4d2688de25eb4 |
| hovercard-subject-tag | issue:947110265 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-zeroconf/python-zeroconf/917/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd473035173a09a54a48fe94199539271e14045bac356e04596f9e89451dadeb/python-zeroconf/python-zeroconf/issues/917 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd473035173a09a54a48fe94199539271e14045bac356e04596f9e89451dadeb/python-zeroconf/python-zeroconf/issues/917 |
| og:image:alt | Code from the README: from zeroconf import ServiceBrowser, Zeroconf class MyListener: def remove_service(self, zeroconf, type, name): print("Service %s removed" % (name,)) def add_service(self, zer... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ahrbe1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/python-zeroconf/python-zeroconf git https://github.com/python-zeroconf/python-zeroconf.git |
| octolytics-dimension-user_id | 120192235 |
| octolytics-dimension-user_login | python-zeroconf |
| octolytics-dimension-repository_id | 21548731 |
| octolytics-dimension-repository_nwo | python-zeroconf/python-zeroconf |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 21548731 |
| octolytics-dimension-repository_network_root_nwo | python-zeroconf/python-zeroconf |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width