If I type the following command into the terminal, it works and a message "test" is sent.
sudo echo "test" | sendxmpp -t -u doorbellding -o gmail.com in06khattab
I wanted to execute this command in Python, but instead of test it would a variable containing the data and time
This is what I have tried, but they all fail.
message="Ding Dong at "+strftime("%l:%M %p on %d-%m-%Y")
os.system('sudo echo '+message+' | sendxmpp -t -u doorbellding -o gmail.com in06khattab') #send hangouts message
os.system('sudo echo "test" | sendxmpp -t -u doorbellding -o gmail.com in06khattab')