Im trying to send a variable in an sms using gammu. Im using the gammu smsd runonreceive to run a python script when I send a message to my raspberry pi from my phone. This is what the script looks like.
#!/usr/bin/python
import os
os.system("sh .webgps.sh > coordinates.text")
file = "/home/pi/coordinates.text"
with open(file) as f:
(lat, long) = f.read().splitlines()
os.system("echo lat | sudo gammu-smsd-inject TEXT 07xxxxxxxxx")
What this script does is it runs a shell script which gets the latitude and longitude from my gps module and puts them in a text file. Then it gets the values from the text file and puts the latitude in the lat variable and the longitude in the long variable. I can verify that this works because when I print the variables I can see latitude and longitude and they are the same values as the ones in the text file.
Now the bit that im having problems with is sending the values to my phone. If i run the python script how it currently is, then i get a message on my phone which says lat. What I want is to be sent the actual values for latitude and longitude and I dont know how to put the variables into the gammu inject text line.