paramiko socket.error: Int or String expected
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的更多相关文章
- catch socket error
whois_handler.dart import 'dart:io'; import 'package:async/async.dart'; import 'dart:convert'; class ...
- [Swift通天遁地]五、高级扩展-(6)对基本类型:Int、String、Array、Dictionary、Date的扩展
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- 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 ...
- int and string
int转string一.#include <sstream> int n = 0; std::stringstream ss; std::string str; ss<<n; ...
- JAVA中int、String的类型转换
int -> String int i=12345;String s="";第一种方法:s=i+"";第二种方法:s=String.valueOf(i); ...
- supervisorctl error: <class 'socket.error'>
http://stackoverflow.com/questions/18859063/supervisor-socket-error-issue supervisorctl reread error ...
- C++ int与string的转化
int本身也要用一串字符表示,前后没有双引号,告诉编译器把它当作一个数解释.缺省情况下,是当成10进制(dec)来解释,如果想用8进制,16进制,怎么办?加上前缀,告诉编译器按照不同进制去解释.8进制 ...
- [C#]List<int>转string[],string[]转为string
// List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...
- C++ 中 int 转string, 以及10进制转2进制
感谢:http://blog.csdn.net/xiaofei2010/article/details/7434737 以及:http://www.cnblogs.com/nzbbody/p/3504 ...
随机推荐
- sails不是内部或外部命令的解决方案
1 安装好node 2 安装sails 打开cmd窗口,用命令 npm -g install sails 安装sails 安装完成后,用命令 sails new testProject 创建项目 会 ...
- Ural 1309 Dispute (递归)
意甲冠军: 给你一个数列: f(0) = 0 f(n) = g(n,f(n-1)) g(x,y) = ((y-1)*x^5+x^3-xy+3x+7y)%9973 让你求f(n) n <= 1e ...
- 得到View Frustum的6飞机
笔者:i_dovelemon 资源:CSDN 日期:2014 / 9 / 30 主题:View Frustum, Plane, View Matrix, Perspective Projection ...
- c#中 uint--byte[]--char[]--string相互转换汇总
原文:c#中 uint--byte[]--char[]--string相互转换汇总 在在做一些互操作的时候往往需要一些类型的相互转换,比如用c#访问win32api的时候往往需要向api中传入DWOR ...
- Scrapy系列教程(2)------Item(结构化数据存储结构)
Items 爬取的主要目标就是从非结构性的数据源提取结构性数据,比如网页. Scrapy提供 Item 类来满足这种需求. Item 对象是种简单的容器.保存了爬取到得数据. 其提供了 类似于词典(d ...
- 发现SQL Server惊天大秘密!!
原文:发现SQL Server惊天大秘密!! --set statistics xml onCREATE TABLE T_TEST(ID INT IDENTITY PRIMARY KEY,Create ...
- 正确openvSwitch不同种类port认识
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdm9uemhvdWZ6/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...
- Android做法说明(3)---Fragment使用app袋或v4包解析
Android做法说明(3)---Fragment使用app袋或v4包解析 1)问题简述 相信非常多的朋友在调用Fragment都会遇到以下的情况: watermark/2/text/aHR0cDov ...
- 使用CASE表达式替代SQL Server中的动态SQL
原文:使用CASE表达式替代SQL Server中的动态SQL 翻译自: http://www.mssqltips.com/sqlservertip/1455/using-the-case-expre ...
- 但从谈论性能点SQL Server选择聚集索引键
简单介绍 在SQL Server中,数据是按页进行存放的.而为表加上聚集索引后,SQL Server对于数据的查找就是依照聚集索引的列作为keyword进行了. 因此对于聚集索引的选择对性能的影响就变 ...