Skip to content

Doesn't work in crontab? #1979

Answered by BurntSushi
lucky3582 asked this question in Q&A
Aug 27, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

From the Python docs for subprocess, emphasis mine:

stdin, stdout and stderr specify the executed program’s standard input, standard output and standard error file handles, respectively. Valid values are PIPE, DEVNULL, an existing file descriptor (a positive integer), an existing file object, and None. PIPE indicates that a new pipe to the child should be created. DEVNULL indicates that the special file os.devnull will be used. With the default settings of None, no redirection will occur; the child’s file handles will be inherited from the parent.

My guess is that your cron system is attaching something to stdin that is being inherited by your Python process. Try using stdin=subprocess.…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lucky3582
Comment options

Answer selected by lucky3582
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants