python - python3.5: serial port reading gives error -
while reading serial port com4 port using python, following error:
---------------------------------------------------------------------------- f:\invsense\motion_driver_6.12\empl-pythonclient>python.exe empl-client.py 4 traceback (most recent call last): file "empl-client.py", line 543, in <module> data_delegate = data) file "empl-client.py", line 23, in __init__ self.s = serial.serial(port,115200) file "c:\users\admin\appdata\local\programs\python\python35-32\lib\site- packages\pyserial-3.1.1-py3.5.egg\serial\serialwin32.py", line 31, in __init__
file "c:\users\admin\appdata\local\programs\python\python35-32\lib\site- packages\pyserial-3.1.1-py3.5.egg\serial\serialutil.py", line 162, in init file "c:\users\admin\appdata\local\programs\python\python35-32\lib\site- packages\pyserial-3.1.1-py3.5.egg\serial\serialutil.py", line 206, in port valueerror: "port" must none or string, not
f:\invsense\motion_driver_6.12\empl-pythonclient>
this error coming serialutil.py. can please me resolve problem. checked com4 port seperately using putty tool , worked fine.
regards vinay
the problem invensense python script.
open empl-client.py in text editor , search line:
comport = int(sys.argv[1]) - 1
change to:
comport = sys.argv[1]
the script trying cast string 'com4' integer before passing serial function, wants string anyway. think maybe using old version of pyserial because there other errors in script.
comment out (or delete) these lines:
self.s.settimeout(0.1) self.s.setwritetimeout(0.2)
run client
python empl-client.py com4
after python client showing mpu data correctly. hope isn't late!
Comments
Post a Comment