I have a python script that copies files from one folder to another on my pi, but is no longer working and i don't know why.
1) I know it is running, because the script sends me an email. 2) I'm not sure if an update to python has happened, but i haven't chained anything on the script and it has been working for weeks.
3) if i manually copy the files on the PI i can see them on another computer via dropbox.
Could it be an auto update, if not how can i find out how to fix it?
Thanks in advance,
Reggie.
#!/usr/bin/env python
import smtplib
import time
import subprocess
import fcntl, sys
################################################### locking section
pid_file = '/run/lock/LOCKFILE-FOR-THIS-SCRIPT.pid'
fh = open(pid_file, 'w')
try:
fcntl.lockf(fh, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
# another instance is running
print 'Error: Another instance is running...'
sys.exit(0)
################################################## locking section end
from email.mime.text import MIMEText
USERNAME = "myemail"
PASSWORD = "mypw"
MAILTO = "mailto"
msg = MIMEText('http://whatever.com:1953 http://whatever2.com:1972')
msg['Subject'] = 'from pi motion script'
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(30)
subprocess.call("mv /mnt/*.jpg /home/pi/box/pi_pictures", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)