Python3 脚本在控制台中运行良好,但在由 crontab 执行时不起作用



我试图让下面的脚本在crontab上成功运行,但它不会工作。

*/3 * * * * /usr/bin/python3 /var/www/secret_directory/main.py > /home/USER/grabber.log

我试着在SSH中运行命令,它工作了:

/usr/bin/python3 /var/www/secret_directory/main.py

如果它工作,输出应该像这样:

100%|██████████████████████████████████████████████████████████████████████████████| 61/61 [00:16<00:00,  3.62it/s]
100%|██████████████████████████████████████████████████████████████████████████| 1696/1696 [01:09<00:00, 24.30it/s]

但是在grabber.log文件中看起来是这样的:

0%|          | 0/1 [00:00<?, ?it/s]
100%|██████████| 1/1 [00:00<00:00,  3.60it/s]
100%|██████████| 1/1 [00:00<00:00,  3.59it/s]

我不知道它是否重要,但它是关于这个软件的:https://github.com/RedBlaze42/Mars2020-images-downloader

谢谢你的帮助!

取出对tqdm的调用;用whatever代替任何看起来像tqdm(whatever)的东西

https://tqdm.github。Io/是一个显示"friendly"进度计,但这显然只对交互式程序有用,当你想在没有终端的地方运行代码时就会有问题。

最新更新