Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Database Locked Error

I'm not sure what 'delete the database and restart app.py' means. Thanks!!!

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

Inside your app.py file are the commands to create and initialize the database if it doesn't already exist. In some cases, the database file (external to the program) get corrupted. Look for a defined DATABASE variable or somename.db defined in the app.py file. It is this database file name that should be removed from the disk using, for example, rm somename.db. Restarting the app is simply rerunning the app.py file as was done initially.

Sorry this is so general. The exact details depends on if you're using flask/peewee, django, or some other framework.

Thanks Chris, this worked for me!