i am having a problem getting crontab to execute a python script. the script works because i can execute it by using: python boxster_school_smtp.py from a command line. i put a line in crontab that look like this: i know this is not a linux mailing list but any help would be appreciated.
<snip>
*/5 * * * * root /usr/local/bin/python /root/scripts/boxster_school
_smtp.py
</snip>
now like i said the python script works by using: python my_script.py from the command line but when i use it in crontab i get some error. here is the error that cron gives:
<snip>
Traceback (most recent call last):
File "/root/scripts/boxster_school_smtp.py", line 19, in ?
mssg = open('mssg.txt', 'r').read()
IOError: [Errno 2] No such file or directory: ' emmssg.txt'
</snip>
the emmssg.txt file is in the /root/script directory so i don't know why it cant find it.
thanks again,
</snip>
now like i said the python script works by using: python my_script.py from the command line but when i use it in crontab i get some error. here is the error that cron gives:
<snip>
Traceback (most recent call last):
File "/root/scripts/boxster_school_smtp.py", line 19, in ?
mssg = open('mssg.txt', 'r').read()
IOError: [Errno 2] No such file or directory: ' emmssg.txt'
</snip>
the emmssg.txt file is in the /root/script directory so i don't know why it cant find it.
thanks again,
--
Daniel McQuay
[EMAIL PROTECTED]
boxster.homelinux.org
814.825.0847
import smtplib import os emmssg = "/root/scripts/emmssg.txt" smtpserver = 'mail.erieit.edu' AUTHREQUIRED = 1 smtpuser = 'dmcquay' smtppass = '******'
#For testing purposes only! RECIPIENTS = ['[EMAIL PROTECTED]'] #This will be used after testing #RECIPIENTS = ['[EMAIL PROTECTED]','[EMAIL PROTECTED]','[EMAIL PROTECTED]', # '[EMAIL PROTECTED]','[EMAIL PROTECTED]', # '[EMAIL PROTECTED]'] SENDER = '[EMAIL PROTECTED]' emmssg = open('emmssg.txt').read() session = smtplib.SMTP(smtpserver) if AUTHREQUIRED: session.login(smtpuser, smtppass) smtpresult = session.sendmail(SENDER, RECIPIENTS, emmssg) if smtpresult: errstr = "" for recip in smtpresult.keys(): errstr = """Could not delivery mail to: %s Server said: %s %s %s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr) raise smtplib.SMTPException, errstr
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor