PythonAnywhere - Tasks Executed Normally But Updating Database Failed

PythonAnywhere – Tasks Executed Normally But Inserting Database Failed

目錄

Original Post

PythonAnywhere – Tasks Executed Normally But Inserting Database Failed


I ran a task on PythonAnywhere, fetching data and inserting to MySQL database in this code. Everything worked fine when I execute it manually. And when executing automatically, it showed finished in log file, but new data was not uploaded to database. Why?

I tried to fix my python file, and ran it over and over again. Finally, I found the stupid mistake. You just have to add the “python3.X” before the file path, like the example in Schedule tasks field.

pythonanywhere - Task Update Database failed
Task Interface
# Wrong
/home/aronhack/agri_wholesale/Agriculture_Wholesale_Update.py
# Correct
python3.7 /home/aronhack/agri_wholesale/Agriculture_Wholesale_Update.py

Content Protection by DMCA.com
A
Aron

以前用MIX這個名字在網路打滾,後來改為Aron。工業設計系畢業,曾任職知名品牌行銷企劃,做點設計,寫文案也寫網站;目前擔任零售業數據分析師。最近開始練格鬥和Python量化投資。

PythonAnywhere

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *