PythonAnywhere - Tasks Executed Normally But Updating Database Failed

PythonAnywhere – Tasks Executed Correctly But Inserting Database Failed

Outline

    Original Post

    PythonAnywhere – Tasks Executed Correctly But Inserting Database Failed


    Original Post

    PythonAnywhere – Tasks Executed Correctly 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

     



    Related Posts

    Aron

    A data scientist working in a retail company, with experience in web design and marketing. Recently dives into cryptocurrency and quantitative investing.

    facebook telegram

    Leave a Reply

    • Required fields are market * .
    • Your email address will not be published.
    • Please ensure your email address is correct, then you will get a notification once a new comment reply.

    Your email address will not be published.