tomaarsen / TwitchMarkovChain

Twitch Bot for generating messages based on what it learned from chat
MIT License
118 stars 25 forks source link

Database error #6

Closed sjbtrn closed 4 years ago

sjbtrn commented 4 years ago

Hello, I need help with running the bot. When I run it it gives me this error: File "c:\Users\Uživatel\Desktop\TwitchMarkovChain-master\Database.py", line 160, in execute with sqlite3.connect(self.db_name) as conn: sqlite3.OperationalError: unable to open database file

Do you know how to fix it?

Thanks

SAJBTR0N

tomaarsen commented 4 years ago

Hello @sajbtr0n!

I've quickly forked my code and tried to replicate your issue, and was able to. Note that the bot creates a database file using the Channel that is supplied in the settings.txt file. With the default settings.txt file that is supplied, this value is #<channel>. This causes the bot to want to write a file called MarkovChain_<channel>.db, but the symbols < and > are not allowed in a database filename, causing the program to throw exactly the error you described. If you change the value for Channel in the settings.txt file to your desired channel, then it should work!

A sample section of this new settings.txt would be:

{
    "Host": "irc.chat.twitch.tv",
    "Port": 6667,
    "Channel": "#CubieDev",
...
}

Then, the bot will successfully create a file MarkovChain_cubiedev.db, which will be used for learning.

I hope this helps!