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. 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect

    在进行Nginx+Tomcat 负载均衡的时候遇到了这个权限问题,在error.log日志中.我们能够看到例如以下: connect() to 127.0.0.1:8080 failed (13: P ...

  2. 【翻译】要理解Ext JS 5小工具

    原版的:Understanding Widgets in Ext JS 5 在Ext JS 5,引入了新的"widgetcolumn",支持在网格的单元格中放置组件. 同一时候,还 ...

  3. Hibernate 映射字段问题[ImprovedNamingStrategy]

    Hibernate 使用JPA 对于映射有3种规则能够配置:DefaultNamingStrategy,ImprovedNamingStrategy,EJB3NamingStrategy 这里仅仅说I ...

  4. UVA 11992 - Fast Matrix Operations(段树)

    UVA 11992 - Fast Matrix Operations 题目链接 题意:给定一个矩阵,3种操作,在一个矩阵中加入值a,设置值a.查询和 思路:因为最多20列,所以全然能够当作20个线段树 ...

  5. Android ListView分页载入(服务端+android端)Demo

    Android ListView分页载入功能 在实际开发中经经常使用到,是每一个开发人员必须掌握的内容,本Demo给出了服务端+Android端的两者的代码,并成功通过了測试. 服务端使用MyEcli ...

  6. jQuery 完成ajax传jsonObject数据,并在后台处理

    效果图: 1.js文件封装的几个js工具 <span style="font-family:KaiTi_GB2312;font-size:18px;">//兼容ie i ...

  7. win7下go web之revel

    win7下go web之revel安装   接着上回记录的win7下go环境搭建,go的开发,现在除了sublime外,LiteIDE比较推荐,下载链接 下载安装后直接打开,需要配置下go环境(本机使 ...

  8. 算法 - 乞讨n中位数(C++)

    //************************************************************************************************** ...

  9. 开源 java CMS - FreeCMS2.1公布

    项目地址:http://www.freeteam.cn/ FreeCMS商业版V2.1更新功能 1.web页面信息採集:通过简单配置就可以抓取目标网页信息,支持增量式採集.keyword替换.定时採集 ...

  10. C++学习笔记1--基础知识

    #include <iomanip> setpresition(int n); 设置输出精度浮点数是n. [goto声明] goto也被称为无条件分支语句购买勇于改变运行顺序的声明.got ...