Multile Lines Output to one command

  gps, pyserial, python

I am faceing and interessting problem.
I need to call (several times) per second the GPS informations from an RPi-Hat. As far as good everything works fine if i call the request one time.
But if i start to loop the command then the respond from the Hat gets bigger and bigger and at one point i run into an write error: serial.serialutil.SerialException: write failed: [Errno 5] Input/output error.
I think the problem if the [Errno 5] is caused by the amount of data the Hat responses.

My Question now is: How do i get only one line of respond for one call.
Obviously i dont need the answer 30 times in one datablock

The Code looks like this:

#!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
    
import serial
import time
    
ser = serial.Serial('/dev/ttyS0',115200)
ser.reset_input_buffer()

power_key = 6
rec_buff = ''
rec_buff2 = ''
time_count = 0

def send_at(command,timeout):
    rec_buff = ''
    ser.write((command+('n')).encode('utf-8'))
    time.sleep(timeout)
    if ser.in_waiting:
        time.sleep(0.01)
        rec_buff = ser.read(ser.in_waiting)
        print(rec_buff)


def power_on(power_key):
    print('SIM7600X is starting:')
    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)
    GPIO.setup(power_key,GPIO.OUT)
    time.sleep(0.1)
    GPIO.output(power_key,GPIO.HIGH)
    time.sleep(2)
    GPIO.output(power_key,GPIO.LOW)
    time.sleep(10)
    ser.reset_input_buffer()
    print('SIM7600X is ready')

def power_down(power_key):
    print('SIM7600X is loging off:')
    GPIO.output(power_key,GPIO.HIGH)
    time.sleep(3)
    GPIO.output(power_key,GPIO.LOW)
    time.sleep(8)
    print('Good bye')
i=0
power_on(power_key)

print('AT+CGPSPWR=1')
print('---------------------------------------------')
send_at('AT+CGPSPWR=1', 1)
#ser.flush()
ser.reset_input_buffer()
ser.reset_output_buffer()
print('AT+CREG?')
print('---------------------------------------------')
time.sleep(2)
send_at('AT+CREG?', 1)
#ser.flush()
ser.reset_input_buffer()
ser.reset_output_buffer()
print('AT+CGPS=1,1')
print('---------------------------------------------')
time.sleep(2)
send_at('AT+CGPS=1,1', 1)
#ser.flush()
ser.reset_input_buffer()
ser.reset_output_buffer()
while i <20:
        if ser.writable():
            print('AT+CGPSINFO')
            print('---------------------------------------------')
            time.sleep(2)
            send_at('AT+CGPSINFO', 1)
            #ser.flush()
            ser.reset_input_buffer()
            ser.reset_output_buffer()

print('---------------------------------------------')
power_down(power_key)

The Output looks like this:

[email protected]:~ $ sudo python3 test_3.py
SIM7600X is starting:
SIM7600X is ready
AT+CGPSPWR=1
---------------------------------------------
b'rrnERRORrn'
AT+CREG?
---------------------------------------------
b'nn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnnAT+CREG?nnn+CREG: 0,1nnnnOKnn'
AT+CGPS=1,1
---------------------------------------------
b'AT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nnnERRORnnAT+CGPS=1,1nn'
AT+CGPSINFO
---------------------------------------------
b'nnERRORnnAT+Password: nnnERRORnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193817.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193818.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn'
AT+CGPSINFO
---------------------------------------------
b'nn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,,141021,193819.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193820.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193821.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn'
AT+CGPSINFO
---------------------------------------------
b'nAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193824.0,567.6,0.0,176.1nnnnOKnn'
AT+CGPSINFO
---------------------------------------------
b'nn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193827.0,567.6,0.0,176.1nnnnOKnn'
AT+CGPSINFO
---------------------------------------------
b'AT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193829.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193829.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193829.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnnAT+CGPSINFOnnn+CGPSINFO: 0000.000000,N,00000.000000,E,141021,193830.0,567.6,0.0,176.1nnnnOKnn'
AT+CGPSINFO
---------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/serial/serialposix.py", line 621, in write
    n = os.write(self.fd, d)
OSError: [Errno 5] Input/output error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_3.py", line 74, in <module>
    send_at('AT+CGPSINFO', 1)
  File "test_3.py", line 18, in send_at
    ser.write((command+('n')).encode('utf-8'))
  File "/usr/local/lib/python3.7/dist-packages/serial/serialposix.py", line 655, in write
    raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: [Errno 5] Input/output error

Source: Python Questions

LEAVE A COMMENT