1

I have made an extensive script that runs fine when started from the command line or IDLE. But when I try to run it with cron it keeps giving errors: IOError: [Errno 32] Broken pipe

1 Answer 1

6

If your script runs too long, cron will close its stdout/stderr that are normally redirected to a log file (through cron). Attempting to print after the timeout will give you broken pipe.

A solution is to use logging or print only to your own log files and never to stdout.

Also, cron has different envinronment, specified at the top of crontab or cron.(daily|hourly|...) files. Make sure it is correct, especially if you rely on PATH or HOME that are set at login.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.