You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Your very own code snippet fails when run in a loop.
import asyncio
from proxybroker import Broker
async def save(proxies, filename):
"""Save proxies to a file."""
with open(filename, 'w') as f:
while True:
proxy = await proxies.get()
if proxy is None:
break
proto = 'https' if 'HTTPS' in proxy.types else 'http'
row = '%s://%s:%d\n' % (proto, proxy.host, proxy.port)
f.write(row)
def main():
proxies = asyncio.Queue()
broker = Broker(proxies)
tasks = asyncio.gather(
broker.find(types=['HTTP', 'HTTPS'], limit=10),
save(proxies, filename='proxies.txt'),
)
loop = asyncio.get_event_loop()
loop.run_until_complete(tasks)
if __name__ == '__main__':
for _ in range(5):
main()
Raises
Traceback (most recent call last):
File "C:\Python\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete
self.run_forever()
File "C:\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
File "C:\Python\Python38\lib\asyncio\base_events.py", line 1823, in _run_once
event_list = self._selector.select(timeout)
File "C:\Python\Python38\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Python\Python38\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Im on Windows 7.
Adding broker.stop() does not solve it.
The text was updated successfully, but these errors were encountered:
Describe the bug
Your very own code snippet fails when run in a loop.
Raises
Traceback (most recent call last):
File "C:\Python\Python38\lib\asyncio\base_events.py", line 603, in run_until_complete
self.run_forever()
File "C:\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
File "C:\Python\Python38\lib\asyncio\base_events.py", line 1823, in _run_once
event_list = self._selector.select(timeout)
File "C:\Python\Python38\lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
File "C:\Python\Python38\lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Im on Windows 7.
Adding
broker.stop()
does not solve it.The text was updated successfully, but these errors were encountered: