我正在尝试与串行WWAN调制解调器接口(用于诊断/信号强度测量)。这是通过我桌面上的板载COM1(115200-8-n-1),通过PuTTY连接。我可以使用Python编写AT命令的脚本,但要打开串行端口却很困难。
我已经按照说明安装了Python 2.7.1和PySerial。我是计算机的本地管理员,在有和没有管理权限的情况下运行了Python,但是当我尝试打开端口时,会得到以下信息:Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> s = serial.Serial(
... port='COM1',
... baudrate=115200
... )
>>> s.open()
Traceback (most recent call last):
File "", line 1, in
File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 56, in open
raise SerialException("could not open port %s: %s" % (self.portstr, ctypes.W
inError()))
serial.serialutil.SerialException: could not open port COM1: [Error 5] Access is
denied.
我的理解是8-N-1是默认值,即使我尝试手动设置它们,它也会抛出相同的异常。
有人能提供建议吗?
提前谢谢。