Running a Python script from crontab
prologic at shortcircuit.net.au
Tue Dec 2 15:44:23 CET 2008
Put your main function in a big
try, except. Catch any and all
errors and log them. Example:
except Exception, error:
log("ERROR: %s" % error)
Hope this helps.
On Wed, Dec 3, 2008 at 12:35 AM, Astley Le Jasper
<Astley.lejasper at gmail.com> wrote:
> I need help ... I've been looking at this every evening for over a
> week now. I'd like to see my kids again!
> I have script that runs fine in the terminal but when I try to run it
> in a crontab for either myself or root, it bails out.
> The trouble is that obviously I get no console when using crontab so
> can't see any traceback. I use logging which shows 'info' messages as
> the script is working, but no error messages. I've peppered it with
> debug messages to try to track it down to a line, but it stops it the
> middle of appending data to a list. I'd expect it to bail out when
> calling a module or reading/writing to a different file.
> Is there any way of getting more info from the app, like popping up a
> console while its running?
> my crontab is:
> 30 15 * * * cd /home/myusername/src && python myscript.py
-- "Problems are solved by method"
More information about the Python-list