我正在尝试使用上面的代码连接到某个路由器,我正在使用 juniperj2320.py 模块,在测试文件中我正在使用来自此http://subversion.assembla.com/svn/clauzsistel08/trunk/dist/的代码库
#!/usr/bin/python
from localconf import *
from juniperj2320 import *
import sys
import traceback
SERIALDEVICE = '/dev/ttyUSB0'
# Now configure the router
try:
router = JuniperJ2320(SERIALDEVICE)
except RouterConfigurationException, err:
print "Router configuration error: ", err
print "Please try again."
sys.exit(1)
但我收到以下错误
./test.py
> /root/pyserial-2.6/examples/serialrouter.py(37)__init__()
-> serial.Serial.__init__(自我,串行设备,波特率=波特率,\
(pdb) c
回溯(最近一次通话最后):
文件“./test.py”,第 30 行,在
路由器 = JuniperJ2320(串行设备)
文件“/root/pyserial-2.6/examples/juniperj2320.py”,第 32 行,在 __init__
字节大小、奇偶校验、停止位、超时)
文件“/root/pyserial-2.6/examples/serialrouter.py”,第 44 行,在 __init__
fdpexpect.fdspawn.__init__(self, self.fileno())
__init__ 中的文件“/usr/lib/python2.6/site-packages/fdpexpect.py”,第 40 行
spawn.__init__(self, None, args, timeout, maxread, searchwindowsize, logfile)
文件“/usr/lib/python2.6/site-packages/pexpect.py”,第 412 行,在 __init__
self.closed = True # 类似文件的对象。
AttributeError:无法设置属性
并且绝对不知道这里发生的事情!任何帮助将不胜感激
谢谢