2016-09-06 36 views
0

我已经在python 3.4上安装了ncclient 0.5.0。我甚至不能只要连接到设备得到没有得到以下错误:Python ncclient unicode字符串不支持编码声明

 
ValueError: Unicode strings with encoding declaration are no supported. 
Please use bytes input or XML fragments without declaration. 

我的连接看起来像这样:

m = manager.connect(host='10.159.11.53', 
        port=830, 
        username='xxxxx', 
        password='xxxxxxxx', 
        hostkey_verify=False, 
        unknown_host_cb=uknown_host_cb, 
        device_params={'name':'default'}, 
        timeout=90) 

任何想法?这是不是Python 3.4准备好声称。

+0

请编辑您的问题以包含完整的堆栈跟踪。似乎API预计一些(或全部)参数是通过'bytes'而不是'str'来实现的,但很难判断哪些没有完整的跟踪。 – mata

+0

找出哪个参数有问题。然后使用解码。 'string'.decode(' UTF-8' )。但我不确定,我总是不确定自己编码的东西! – Hannes

+0

刚刚检查过...这在Python 2.7中工作得很好。 –

回答

1

ncclient 0.5.0支持Python 2.6 < =版本< 3.0根据文档。 升级到最新的ncclient版本以使用Python3。

相关问题