TypeError in connection exception handling code in 1.16.0 #615

nchammas opened this Issue Nov 7, 2015 · 3 comments


None yet

3 participants

nchammas commented Nov 7, 2015

I'm seeing this problem in 1.16.0 but not 1.15.4. I'm running Python 3.5.0 on OS X.

I'm trying to connect to a host as it comes up and am getting this failure:

Traceback (most recent call last):
  File "flintrock.py", line 714, in get_ssh_client
  File ".../venv/lib/python3.5/site-packages/paramiko/client.py", line 311, in connect
    raise NoValidConnectionsError(errors)
  File ".../venv/lib/python3.5/site-packages/paramiko/ssh_exception.py", line 166, in __init__
    body = ', '.join([x[0] for x in addrs[:-1]])
TypeError: 'dict_keys' object is not subscriptable

This error seems to refer to this line. Looking at the history of ssh_exception.py and client.py, I'm guessing this problem was introduced as part of this commit.

I'm willing to track this down and provide a patch if you can give me a pointer. Perhaps _families_and_addresses() is not behaving as expected?

edk0 commented Nov 7, 2015

I don't have a good way to test this but I believe the bug is on the previous line :) in python 3 dict.keys returns a view not a sequence; addr needs to be list(errors.keys())

nchammas commented Nov 7, 2015

Oh, you're right. The traceback even gives it away. :derp:


Rollin' into the PR, thanks @nchammas / @edk0!

@bitprophet bitprophet closed this Nov 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment