paramiko socket.error: Int or String expected

paramiko的环境:

Python 2.6.6

paramiko==1.14.0

正常的paramiko用法:

>>> import paramiko
>>> client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('10.2.1.243', port=22, username='root', password='', timeout=600)
stdin, stdout, stderr = client.exec_command('pwd')>>> client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>>> client.connect('10.2.1.243', port=22, username='root', password='', timeout=600)
>>> stdin, stdout, stderr = client.exec_command('pwd')
>>> stdout.read()
'/root\n'

出现这种错误的情况:

>>> import paramiko
>>> client = paramiko.SSHClient()
>>> client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>>> port=22L
>>> client.connect('10.2.1.243, port=port, username='root', password='', timeout=600)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/project/maintain/lib/python2.6/site-packages/paramiko/client.py", line 222, in connect
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
socket.error: Int or String expected

上面这个错误,是因为connect方法中的port设置为Long int了,把port转为string或者int,可以修复这个问题

注意:

这个错误,在Python2.7.6 paramiko==1.4.0 中并没有出现,其它版本,没有做更多的测试

paramiko socket.error: Int or String expected的更多相关文章

  1. catch socket error

    whois_handler.dart import 'dart:io'; import 'package:async/async.dart'; import 'dart:convert'; class ...

  2. [Swift通天遁地]五、高级扩展-(6)对基本类型:Int、String、Array、Dictionary、Date的扩展

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...

  3. P1980 计数问题(int,string,stringstream)

    题目描述 试计算在区间 1 到 n 的所有整数中,数字x(0 ≤ x ≤ 9)共出现了多少次?例如,在 1 到 11 中,即在 1,2,3,4,5,6,7,8,9,10,11 中,数字 1 出现了 4 ...

  4. int and string

    int转string一.#include <sstream> int n = 0; std::stringstream ss; std::string str; ss<<n; ...

  5. JAVA中int、String的类型转换

    int -> String int i=12345;String s="";第一种方法:s=i+"";第二种方法:s=String.valueOf(i); ...

  6. supervisorctl error: <class 'socket.error'>

    http://stackoverflow.com/questions/18859063/supervisor-socket-error-issue supervisorctl reread error ...

  7. C++ int与string的转化

    int本身也要用一串字符表示,前后没有双引号,告诉编译器把它当作一个数解释.缺省情况下,是当成10进制(dec)来解释,如果想用8进制,16进制,怎么办?加上前缀,告诉编译器按照不同进制去解释.8进制 ...

  8. [C#]List<int>转string[],string[]转为string

    // List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...

  9. C++ 中 int 转string, 以及10进制转2进制

    感谢:http://blog.csdn.net/xiaofei2010/article/details/7434737 以及:http://www.cnblogs.com/nzbbody/p/3504 ...

随机推荐

  1. Godaddy Drupal Update

    Godaddy对Drupal默认安装仅仅支持到7.22,眼下Drupal已经升级到7.28,安装完Drupal 7.22后,仅仅能手工升级. 安装Drupal在:https://hostingconn ...

  2. ViewData ViewBag ViewModel

    ViewBag 里可以携带dynamic的数据. Model 是从control传过来的模型数据. 我自己感觉ViewBag 可以携带少量的数据,但是我同事喜欢部分页partial 请求,ViewBa ...

  3. 乐在其中设计模式(C#) - 解释器模式(Interpreter Pattern)

    原文:乐在其中设计模式(C#) - 解释器模式(Interpreter Pattern) [索引页][源码下载] 乐在其中设计模式(C#) - 解释器模式(Interpreter Pattern) 作 ...

  4. 如何更改Java括号中的默认对齐

    (1)在使用程序猿非常Java当大括号的排列有感就是它的不那么整齐! 很多人不知道为什么会这样: public class HelloWorld{ pulic static void main(Str ...

  5. NET5实践:项目创建-结构概述-程序运行-发布部署

    ASP.NET5实践01:项目创建-结构概述-程序运行-发布部署   1.项目创建 ASP.NET5项目模板有三种: 新建项目: 选择模板: 2.结构概述 References对应配置是project ...

  6. Guest与virtio netdev交互模式

    Qemu为virtio设备分配了专门的pci设备ID,device IDs (vendor ID 0x1AF4) from 0x1000 through 0x10FF,而pci子系统中的厂商ID和设备 ...

  7. resharper 设置代码颜色

  8. Xcode 6 AutoLayout Size Classes

    1.基本概念 在iPad和iPhone 5出现之前,iOS设备就唯独一种尺寸. 我们在做屏幕适配时须要考虑的唯独设备方向而已. 而非常多应用并不支持转向,这种话就全然没有屏幕适配的工作了. 随着iPa ...

  9. c++ 学籍管理系统v 1.0

    #include<iostream> #include <string> #include<conio.h> using namespace std; class ...

  10. PHP redis操作类 个人总结

    <pre name="code" class="php"><span style="font-size:18px;"> ...