Add checks for no database, print error

This commit is contained in:
Kristy F 2026-03-31 12:43:27 -04:00
parent d4a0702a8a
commit bec0e301b2

View file

@ -42,8 +42,11 @@ fileofDB = sql.connect("songDatabase.db")
songDatabase = fileofDB.cursor()
#song directory
songDatabase.execute("SELECT * FROM meta WHERE id='songDirectory';")
soundLocation = songDatabase.fetchall()[0][1]
try:
songDatabase.execute("SELECT * FROM meta WHERE id='songDirectory';")
soundLocation = songDatabase.fetchall()[0][1]
except sql.OperationalError:
print("No Database Found, try running databaseGenerator.py")
if soundLocation[-1] == "/" or soundLocation[-1] == "\\":
pass
elif "/" in soundLocation: