Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigurationError: Database not set up, or unavailable. (modules/rss.py:31 #515

Closed
N3bTcx opened this issue Apr 24, 2014 · 8 comments
Closed

Comments

@N3bTcx
Copy link

N3bTcx commented Apr 24, 2014

Hello
When I'm trying to run $ willie my database was not recognized. I've just install python-mysqldb

Error: Unable to connect to user settings DB.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/willie/__init__.py", line 45, in run
    p = bot.Willie(config)
  File "/usr/local/lib/python2.7/dist-packages/willie/bot.py", line 92, in __init__
    self.db.add_table('preferences', ['name'], 'name')
  File "/usr/local/lib/python2.7/dist-packages/willie/db.py", line 249, in add_table
    db = self.connect()
  File "/usr/local/lib/python2.7/dist-packages/willie/db.py", line 299, in connect
    db=self._dbname
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1049, "Unknown database 'will'")

I don't understand why. The important thing is I installed it because of
Error in rss setup procedure: ConfigurationError: Database not set up, or unavailable. (modules/rss.py:31) when I start Willie.

I've probably forget a package. I'm on Python 2.7.3with mysql Ver 14.14 Distrib 5.5.35.

@N3bTcx N3bTcx changed the title OperationalError: (1049, "Unknown database 'willie'") ConfigurationError: Database not set up, or unavailable. (modules/rss.py:31 Apr 24, 2014
@N3bTcx
Copy link
Author

N3bTcx commented Apr 24, 2014

Other question, probably not related. But actualy link posted doesn't return anything. If I use .titleI get answer not on all links... I don't have any [url] rules.

[11:52] <@        n3b> | .title http://google.com
[11:52] <     Willie> | n3b: [ Google ] - google.com
[11:53] <@        n3b> | !title https://github.com/embolalia/willie/wiki/Core-configuration-settings
nothing...

@elad661
Copy link
Contributor

elad661 commented Apr 24, 2014

If you are using ubuntu or debian, see Issue #510 for the https thing. For the database thing, run ./willie --configure-database, and please report here to tell us if it worked.

@N3bTcx
Copy link
Author

N3bTcx commented Apr 24, 2014

Thanks for your quick answer @elad661

For the url it's fixed
I've installed backports.ssl_match_hostname at the begining but ca_certs was missing to the .willie/default.cfg
I've added :

[core]
...
ca_certs = /etc/ssl/certs/ca-certificates.crt

No error when I create the database with willie --configure-database.

After lauching willie I have User settings database type is not supported. You may be missing the module for it. Ignoring.

@elad661
Copy link
Contributor

elad661 commented Apr 24, 2014

What is the database type configured in the config file? Does opening python and typing import MySQLdb works?

@N3bTcx
Copy link
Author

N3bTcx commented Apr 24, 2014

I use MySQL.
You're wright when I enter import MySQLdb I get

Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb

So I've installed apt-get install python-mysqldb but now I get this :

willie
Error: Unable to connect to user settings DB.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/willie/__init__.py", line 45, in run
    p = bot.Willie(config)
  File "/usr/local/lib/python2.7/dist-packages/willie/bot.py", line 92, in __init__
    self.db.add_table('preferences', ['name'], 'name')
  File "/usr/local/lib/python2.7/dist-packages/willie/db.py", line 249, in add_table
    db = self.connect()
  File "/usr/local/lib/python2.7/dist-packages/willie/db.py", line 299, in connect
    db=self._dbname
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (1049, "Unknown database 'willie'")

Even with willie --configure-database

@elad661
Copy link
Contributor

elad661 commented Apr 24, 2014

Maybe we don't have code for the database creation and you have to create it manually. @embolalia would know

@N3bTcx
Copy link
Author

N3bTcx commented Apr 24, 2014

Thanks @elad661 for your help.

@N3bTcx
Copy link
Author

N3bTcx commented Apr 24, 2014

Ok fixed. Have to create the database manually.

For people who want to do it
$ mysql
SHOW DATABASES; Normaly you don't have the one created with willie --configure-database
CREATE DATABASE database-name;
GRANT ALL PRIVILEGES ON database-name.* TO "user"@"hostname" IDENTIFIED BY "password"; Like GRANT ALL PRIVILEGES ON willie.* TO root@localhost IDENTIFIED BY "superpassword";
FLUSH PRIVILEGES;

And here we go !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants