Here's what syslog logs:

 CRON[13315]: (root) CMD (cd /home/user/insta-mary/ && python3 ./post.py > /home/user/insta-mary/log) postfix/pickup[13044]: 92A7B42D48: uid=0 from=<root> postfix/cleanup[13277]: 92A7B42D48: message-id=<20170125150801.92A7B42D48@br.com> postfix/qmgr[10403]: 92A7B42D48: from=<root@br.com>, size=2216, nrcpt=1 (queue active) postfix/local[13279]: 92A7B42D48: to=<root@br.com>, orig_to=<root>, relay=local, delay=0.17, delays=0.11/0/0/0.06, dsn=2.$ postfix/qmgr[10403]: 92A7B42D48: removed 

The logs themselves /home/user/insta-mary/log are clean.

Maybe you need to read what postfix writes. But I do not understand how. Tell me please.

PS: There are several other Python scripts that work correctly through cron .

    1 answer 1

    specify the full path to the executable program.

    i.e., not python3 , but (for example) /usr/bin/python3 . The exact path to the desired program can be found using the which program:

     $ which python3 

    The logs themselves /home/user/insta-mary/log are clean.

    in such cases, it makes sense to redirect not only stdout , but also stderr . those. instead

     ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ° > Ρ„Π°ΠΉΠ» 

    write:

     ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ° > Ρ„Π°ΠΉΠ» 2>&1 

    The environment variables in your user shell sessions are significantly different from the environment variables in shell sessions launched by the crond program. If your program requires some special environment variables, you can add them to the edited crontab file (preferably at the very beginning):

     пСрСмСнная=Π·Π½Π°Ρ‡Π΅Π½ΠΈΠ΅ 

    You can view all environment variables (and their values) using the env program. The same program can also be used in a crontab file by redirecting its output to some file:

     env > /tmp/ΠΊΠ°ΠΊΠΎΠΉ-Π½ΠΈΠ±ΡƒΠ΄ΡŒ-Ρ„Π°ΠΉΠ» 
    • He knew about the full way, it did not help. About error logs thanks, I understood what the problem was. The absence of the imageio module imageio.plugins.ffmpeg.download() . Although it is strange, because it was downloaded before that, and the script is executed by the user. Apparently this is due to cron . Do not tell me what could be the reason, or is it better to create a new question?) - St. Ivan
    • one
      supplemented the answer. - aleksandr barakin