I have a python script to send me an email when i detect motion from my noir Pi camera, which is been successfully called.
I know the script is being called, as i get the email on movement; but the script doesn't copy the jpgs from /mnt/
to /home/pi/box/pi_pictures
Have i got the subprocess.call
syntax correct at the bottom of this script?
#!/usr/bin/env python
import smtplib
import subprocess
from email.mime.text import MIMEText
USERNAME = "theemailaddressisendfrom.com"
PASSWORD = "mypassword"
MAILTO = "myemailaddress.com"
msg = MIMEText('blar blar')
msg['Subject'] = 'from pi script test1'
msg['From'] = USERNAME
msg['To'] = MAILTO
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo_or_helo_if_needed()
server.starttls()
server.ehlo_or_helo_if_needed()
server.login(USERNAME,PASSWORD)
server.sendmail(USERNAME, MAILTO, msg.as_string())
server.quit()
time.sleep(20)
subprocess.call("cp /mnt/*.jpg /home/pi/box/pi_pictures", shell=True)
subprocess.check_output(['cp', '/mnt/*.jpg','/home/pi/box/pi_pictures'])
– dry Mar 4 '14 at 15:30subprocess.call("cp /mnt/*.jpg /home/pi/box/pi_pictures", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
. Maybe this helps. Otherwise try adding the full path ofcp
, So"/bin/cp /mnt..."
– Gerben Mar 4 '14 at 16:45