Answer
That's not a hostname:
hostname = "username@hobbes.cs.ucsb.edu"
Instead, that's a connection string. Remove the username@
section, and it should connect again.
Further Information
Remember, you can always look at the source code. Here, you can see that hostname is passed directly into the raw socket call:
socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
Looking at the help for socket.getaddrinfo
, we can see it's trying to resolve an actual hostname, similar to the syntax required for nslookup
:
>>> print socket.getaddrinfo.__doc__
getaddrinfo(host, port [, family, socktype, proto, flags])
-> list of (family, socktype, proto, canonname, sockaddr)
Resolve host and port into addrinfo struct.
Lastly, I would recommend looking at enabling debugging
in paramiko, and other underlying libraries:
>>> import logging
>>> logger = paramiko.util.logging.getLogger()
>>> logger.setLevel(logging.DEBUG)