Python Script not running in crontab calling pysaunter

后端 未结 2 1681
鱼传尺愫
鱼传尺愫 2020-12-20 21:43

I have read multiple posts and many articles detailing that scipts in a cron job need to keep the environment variables necessary to run inside the script itself due to the

2条回答
  •  不知归路
    2020-12-20 22:11

    What you've said makes no sense.

    You say shell_env = sys.path. sys.path is a list of folders for python to look for modules, not an environment variable mapping!

    You then use that in subprocess.call. Perhaps you meant to write env=my_env.

    That's the next problem. First, PATH should be a list of folder separated by ':'. You just tack shell_path onto the last folder.

    Finally, python uses PYTHONPATH as a list to locate python modules (which seems to be what problem you're having.)

提交回复
热议问题