Python Subprocess returns non-zero exit status only in cron

后端 未结 1 1453
梦毁少年i
梦毁少年i 2021-01-12 15:26

I have a Python script that manages a series of CasperJS tasks and processes the result. It runs well from the command line, but when I run the script in cron, I get the err

1条回答
  •  [愿得一人]
    2021-01-12 15:54

    You should try to capture stderr in addition to stdout so that you can find out exactly why the program is failing (assuming it does indeed print some errors for you)

    cmd = ['/path/to/casperjs', '/path/to/doSomething.js', 'args']
    response = subprocess.check_output(cmd, 
                    shell=True,
                    stderr=subprocess.STDOUT)
    

    0 讨论(0)
提交回复
热议问题