Forums

Always on task script does not perform database insertion in sqlite3

I have a script to scrape the data from different websites and stores in my Sqlite3 Database. When I run this script from the console it runs perfectly.

I have exception handling used like try if the data is found and it's not duplicate insert into DB and except could not find any data.

But when putting the script on always on task the program automatically goes to the exception case ie; could not find any data

Any idea what could probably go wrong here?

How are you specifying the location of the database file in your code? If it's just a relative path (for example, "mydatabase.db", then you might be running into problems with the current working directory. If SQLite can't find the database at the location it thinks you want it to load it from, it will just create an empty database and then use that.

Hi, I have mentioned it as a base directory only, and when I run from bash console it works fine, so I think the defined database directory is correct.

Could you copy/paste the exact code you're using to connect to it here? Or if there's stuff you'd rather not put into a public post on the forums, you could send it to support@pythonanywhere.com.

okay, I'm sending it to the support. thanks

I have sent it over the mail

ok, have responded over email. thanks!