Hi @Mehrdad ,
The output terminal does not show anything, and there is only one library per line for each library , as shown below
Right, your requirements.txt
looks correct to me. So apparently you can run the code, but you get no output i.e. the GPS coordinates, is this correct?
I think it didn’t import the libraries since they have a line below them in main.py but you have this warning as well!
I believe the libraries were imported, as otherwise you would get an import error and the code would not run at all. You can verify this by running this test code adapted from here: https://openbase.com/python/pynmea2
#!/usr/bin/python3
import sys
import pynmea2
import serial
serial_port = "/dev/apalis-uart2"
if len(sys.argv) > 1:
serial_port = sys.argv[1]
ser = serial.Serial(serial_port,9600, 8, 'N', 1, timeout=1)
msg = pynmea2.parse("$GPGGA,184353.07,1929.045,S,02410.506,E,1,04,2.6,100.00,M,-33.9,M,,0000*6D")
print("Time = " + msg.timestamp.strftime("%H:%M:%S"))
print("Latitude = " + msg.lat + ", " + msg.lat_dir)
print("Longitude = " + msg.lon + ", " + msg.lon_dir)
print("\n")
If serial
and pynmea2
are not imported you would get an error at execution time. On my side the code above worked without problems:
I recommend debugging your code and checking the serial data i.e. the value of variable data
after
data = data.decode("utf-8","ignore").rstrip()
Also, check how your GPS module sends serial data, like the supported baud rate, number of data bits, parity, etc. and change the serial initialization accordingly.
Best regards,
Lucas Akira