I am building a bittorrent client using the python 3.4 asyncio library. I 
get up to a certain point in the protocol (receive Unchoke message from a 
remote peer) and then the remote peer closes the connection. Here is the 
output to the console. 
https://docs.python.org/2/reference/datamodel.html#object.__del__ explains 
some nuances with __del__. I assume I need to do something in my code, but 
I need a hint. Everytime my client receives the Unchoke message, this error 
occurs.

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

>> c:\Anaconda3\python .\message_types.py

received Handshake from peer 78.187.198.160
78.187.198.160: successfully read Handshake
received Handshake from peer 186.106.94.63
186.106.94.63: successfully read Handshake
78.187.198.160: successfully read Not Supported
186.106.94.63: successfully read Not Supported
received Bitfield from peer 78.187.198.160
78.187.198.160: successfully read Bitfield
received Bitfield from peer 186.106.94.63
186.106.94.63: successfully read Bitfield
186.106.94.63: wrote INTERESTED
186.106.94.63: client ready to receive Unchoke
received Have from peer 186.106.94.63
received Unchoke from peer 186.106.94.63
[WinError 10054] An existing connection was forcibly closed by the remote 
host

Exception ignored in: <bound method _WindowsSelectorEventLoop.__del__ of 
<_WindowsSelectorEventLoop running=False closed
=False debug=True>>
Traceback (most recent call last):
  File "c:\Anaconda3\lib\asyncio\base_events.py", line 361, in __del__
  File "c:\Anaconda3\lib\asyncio\selector_events.py", line 98, in close
  File "c:\Anaconda3\lib\asyncio\base_events.py", line 340, in close
  File "c:\Anaconda3\lib\logging\__init__.py", line 1262, in debug
  File "c:\Anaconda3\lib\logging\__init__.py", line 1409, in _log
  File "c:\Anaconda3\lib\logging\__init__.py", line 1419, in handle
  File "c:\Anaconda3\lib\logging\__init__.py", line 1481, in callHandlers
  File "c:\Anaconda3\lib\logging\__init__.py", line 853, in handle
  File "c:\Anaconda3\lib\logging\__init__.py", line 1040, in emit
  File "c:\Anaconda3\lib\logging\__init__.py", line 1030, in _open
NameError: name 'open' is not defined
Exception ignored in: <bound method Task.__del__ of <Task finished 
coro=<downloader() done, defined at .\message_types.p
y:934> exception=KeyError(None,) created at 
c:\Anaconda3\lib\asyncio\tasks.py:330>>
Traceback (most recent call last):
  File "c:\Anaconda3\lib\asyncio\tasks.py", line 94, in __del__
  File "c:\Anaconda3\lib\asyncio\futures.py", line 216, in __del__
  File "c:\Anaconda3\lib\asyncio\base_events.py", line 1037, in 
call_exception_handler
  File "c:\Anaconda3\lib\logging\__init__.py", line 1303, in error
  File "c:\Anaconda3\lib\logging\__init__.py", line 1409, in _log
  File "c:\Anaconda3\lib\logging\__init__.py", line 1419, in handle
  File "c:\Anaconda3\lib\logging\__init__.py", line 1481, in callHandlers
  File "c:\Anaconda3\lib\logging\__init__.py", line 853, in handle
  File "c:\Anaconda3\lib\logging\__init__.py", line 1040, in emit
  File "c:\Anaconda3\lib\logging\__init__.py", line 1030, in _open
NameError: name 'open' is not defined

Reply via email to