Strange python script behaviour

Łukasz lkrzysiak at gmail.com
Tue Aug 4 10:33:17 CEST 2009


On 4 Sie, 10:08, Lars Behrens <spam.bus... at web.de> wrote:
> Łukasz wrote:
> > The strangest thing is that if I change command in CRON
>
> > from
> > python /home/xxx/script.py
> > to
> > python /home/xxx/script.py  > /tmp/script.log 2>&1
>
> > the script always works correctly!!!
>
> > The question is WHY? Any ideas?
>
> Seems to me that this is more of a shell thing...
>
> First of all, it is always a good idea to call applications with their full
> path from cronjobs:
>
> /usr/bin/python /home/xxx/script.py or whatever the output of your "which
> python" may be.
>
> How did you create the cronjob? Dependending on the editor you used, maybe
> there is a missing newline...
>

No, I've just simplified cron entries to not mess the example :) The
key thing was redirecting stdin & stderr to file. But thanks
anyway... :)




More information about the Python-list mailing list