Ok
now I don't get this error
but when I try to run the code I get that somehting is wrong with the modem-cmd package
now I don't get this error
but when I try to run the code I get that somehting is wrong with the modem-cmd package
import time import datetime import serial import pynmea2 from modemcmd import modemcmd from modemcmd import ModemcmdException from modemcmd import ModemcmdTimeoutException ser = serial.Serial('/dev/ttyUSB1',9600,timeout = 0.5) ModemInfo = '/dev/ttyUSB2' try: result = modemcmd('/dev/ttyUSB2', 'AT+CSQ', 2) except ModemcmdTimeoutException as e: print (e) except ModemcmdException as e: print (e)but I get this error:
Traceback (most recent call last): File "GetAllData_test.py", line 20, in <module> result = modemcmd('/dev/ttyUSB2', 'AT+CSQ', 2) File "/home/pi/.local/lib/python3.7/site-packages/modemcmd/__init__.py", line 26, in modemcmd serial.write(cmd) File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 532, in write d = to_bytes(data) File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 63, in to_bytes raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq)) TypeError: unicode strings are not supported, please encode to bytes: 'AT+CSQ\r'