bmuller / kademlia

A DHT in Python using asyncio
http://kademlia.readthedocs.org
MIT License
830 stars 210 forks source link

example error #43

Closed jianzfb closed 6 years ago

jianzfb commented 6 years ago

Hi, author I confront error when running example. After running examples/first_node.py, examples/set.py is launched. My python version is 3.6. Some errors are located at 'loop.run_until_complete(server.bootstrap([bootstrap_node]))'

2018-01-27 15:55:34,424 - kademlia.network - INFO - Node 620640661369763367814907233484537209378776020287 listening on 0.0.0.0:8469 2018-01-27 15:55:34,438 - kademlia.network - DEBUG - Refreshing routing table 2018-01-27 15:55:34,442 - kademlia.network - DEBUG - Attempting to bootstrap node with 1 initial contacts Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1531, in globals = debugger.run(setup['file'], None, None, is_module) File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 938, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/zhangken/PycharmProject/kademlia/examples/set.py", line 24, in loop.run_until_complete(server.bootstrap([bootstrap_node])) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 449, in run_until_complete return future.result() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 241, in _step result = coro.throw(exc) File "/Users/zhangken/PycharmProject/kademlia/kademlia/network.py", line 125, in bootstrap gathered = await asyncio.gather(*cos) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 304, in _wakeup future.result() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/tasks.py", line 239, in _step result = coro.send(None) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 121, in send return self.gen.send(value) File "/Users/zhangken/PycharmProject/kademlia/kademlia/network.py", line 133, in bootstrapnode return Node(result[1], addr[0], addr[1]) if result[0] else None TypeError: 'bool' object is not subscriptable**

Actually, at first_node.py side, there is no error and it has received another node info. logs is here

2018-01-27 15:55:11,566 - kademlia.network - INFO - Node 66545907984935011663605094311617222781228204585 listening on 0.0.0.0:8468 2018-01-27 15:55:11,569 - kademlia.network - DEBUG - Refreshing routing table 2018-01-27 15:55:34,452 - kademlia.protocol - INFO - never seen 127.0.0.1:8469 before, adding to router

bmuller commented 6 years ago

Don't run it from PyCharm, run it from the command line. If you're still having an issue, then please feel free to reopen this ticket - but please include the commands you use to run each script, the full version of Python and the Kademlia library you're using, and the full error trace. Thanks!