Modify

Opened 15 years ago

Closed 15 years ago

#5397 closed defect (invalid)

AuthOpenID: RuntimeError: Error using database connection module (Maybe it can't be imported?)

Reported by: eliot.lee@… Owned by: Dalius
Priority: highest Component: AuthOpenIdPlugin
Severity: blocker Keywords: database module error
Cc: Trac Release: 0.11

Description

Since I have heard NO reply from the author on this issue and I need to get this plugin working, I am posting the error I receive here. Any suggestions are most welcome. Thank you in advance. Peace and Serenity.

BACKGROUND:

Running Trac 0.11.3 with mod_python, Python 2.6, PostgreSQL on a 32-bit machine, fresh install with no other plugins being installed.

ERROR:

Traceback (most recent call last):

File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 367, in send_error

'text/html')

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 707, in render_template

template = self.load_template(filename, method=method)

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 683, in load_template

self.templates = TemplateLoader?(self.get_all_templates_dirs(),

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 421, in get_all_templates_dirs

for provider in self.template_providers:

File "/usr/lib/python2.6/site-packages/trac/core.py", line 67, in extensions

return filter(None, [component.compmgr[cls] for cls in extensions])

File "/usr/lib/python2.6/site-packages/trac/core.py", line 204, in getitem

component = cls(self)

File "/usr/lib/python2.6/site-packages/trac/core.py", line 108, in maybe_init

init(self)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 152, in init

self.store = self._getStore(db)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 165, in _getStore

return PostgreSQLStore(db)

File "build/bdist.linux-i686/egg/openid/store/sqlstore.py", line 112, in init

raise RuntimeError?("Error using database connection module "

RuntimeError?: Error using database connection module (Maybe it can't be imported?)

Attachments (1)

trac.ini.txt (1.2 KB) - added by eliot.lee@… 15 years ago.
Snippet of Config file with relevant AuthOpenID configs

Download all attachments as: .zip

Change History (17)

Changed 15 years ago by eliot.lee@…

Attachment: trac.ini.txt added

Snippet of Config file with relevant AuthOpenID configs

comment:1 Changed 15 years ago by Dalius

I am author of this plugin. OK it seems my trac is broken...

But OK. I can answer here. I have never tested on PostgreSql myself so there could be some problems. We can communicate and will resolve this problem together. You will need to download source code version First thing you should try:

Modify authopenid.py line 165 and change it from

PostgreSQLStore(db)

to

PostgreSQLStore(db.cnx.cnx)

Does it help?

comment:2 Changed 15 years ago by eliot.lee@…

Thanks for you reply.

Any other method than Mercurial to get the source code?

I would really appreciate your consideration of rolling up that change to the binary release so that I can run the python install or easy_install processes rather than messing around with source code.

But if you can provide another method for getting the source code, I'll pursue that route.

Thanks in advance.

comment:3 Changed 15 years ago by eliot.lee@…

Never mind...I misread your instructions.

I did download the source from:

http://hg.sandbox.lt/authopenid-plugin/archive/v0.2.tar.gz

I'll modify that file as you recommended and see if it works.

Thanks.

comment:4 Changed 15 years ago by anonymous

That code change did not work...

Traceback (most recent call last):

File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 367, in send_error

'text/html')

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 707, in render_template

template = self.load_template(filename, method=method)

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 683, in load_template

self.templates = TemplateLoader(self.get_all_templates_dirs(),

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 421, in get_all_templates_dirs

for provider in self.template_providers:

File "/usr/lib/python2.6/site-packages/trac/core.py", line 67, in extensions

return filter(None, [component.compmgr[cls] for cls in extensions])

File "/usr/lib/python2.6/site-packages/trac/core.py", line 204, in getitem

component = cls(self)

File "/usr/lib/python2.6/site-packages/trac/core.py", line 108, in maybe_init

init(self)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 152, in init

self.store = self._getStore(db)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 165, in _getStore

return PostgreSQLStore(db.cnx.cnx)

File "build/bdist.linux-i686/egg/openid/store/sqlstore.py", line 112, in init

raise RuntimeError("Error using database connection module "

RuntimeError: Error using database connection module (Maybe it can't be imported?)

Note the following:

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 165, in _getStore

return PostgreSQLStore(db.cnx.cnx)

Any other suggestions?

comment:5 Changed 15 years ago by eliot.lee@…

Sorry for duplicate posting, forgot to put in my email address as username and I would love to get this plugin working with PostgreSQL:

That code change did not work...

Traceback (most recent call last):

File "/usr/lib/python2.6/site-packages/trac/web/api.py", line 367, in send_error

'text/html')

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 707, in render_template

template = self.load_template(filename, method=method)

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 683, in load_template

self.templates = TemplateLoader?(self.get_all_templates_dirs(),

File "/usr/lib/python2.6/site-packages/trac/web/chrome.py", line 421, in get_all_templates_dirs

for provider in self.template_providers:

File "/usr/lib/python2.6/site-packages/trac/core.py", line 67, in extensions

return filter(None, [component.compmgr[cls] for cls in extensions])

File "/usr/lib/python2.6/site-packages/trac/core.py", line 204, in getitem

component = cls(self)

File "/usr/lib/python2.6/site-packages/trac/core.py", line 108, in maybe_init

init(self)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 152, in init

self.store = self._getStore(db)

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 165, in _getStore

return PostgreSQLStore(db.cnx.cnx)

File "build/bdist.linux-i686/egg/openid/store/sqlstore.py", line 112, in init

raise RuntimeError?("Error using database connection module "

RuntimeError?: Error using database connection module (Maybe it can't be imported?)

Note the following:

File "build/bdist.linux-i686/egg/authopenid/authopenid.py", line 165, in _getStore

return PostgreSQLStore(db.cnx.cnx)

Any other suggestions?

comment:6 Changed 15 years ago by Dalius

Yes, another idea. You might be missing python postgresql module that is used by python openid. I will try find out what module it is.

comment:7 Changed 15 years ago by Dalius

Python openid is using psycopg or psycopg2.

comment:8 Changed 15 years ago by eliot.lee@…

Thank you for the reply.

Would you be able to narrow down which library I should install? I don't want to spend time installing each to test. Thank you.

comment:9 Changed 15 years ago by Dalius

Python-openid is using psycopg or psycopg2.

comment:10 Changed 15 years ago by Dalius

I think psycopg2 is better choice (that's impression from quick look at google search results). I have never used PostgreSQL myself.

I still wonder how trac works without python postgresql library? Does trac run for you without openid plugin?

comment:11 Changed 15 years ago by anonymous

Yes, we have a half dozen Trac Projects all referencing its own individual PostgreSQL database and they are running just fine.

This is the only Project that I have attempted to set-up with OpenID and it is crapping out. Sorry. But I am a bit frustrated that you have not thoroughly tested your plugin with all RDBMS that core Trac supports.

We absolutely need to use PostgreSQL and unfortunately, for this particular Trac Project that will be externally facing (our internal Trac Projects are using the LDAP plugin just fine), we need to use OpenID.

I have requested our sys admins to install the psycopg2 library since I do not have root permissions even through sudo to install packages like that.

In the mean time, you may consider testing your plugin with all the RDBMS that core Trac supports and release a new working version for them soon.

Thanks.

comment:12 Changed 15 years ago by Dalius

About testing with all the RDBMS: that's my free time project and I work on it when I have free time from other free time projects and current economic crisis doesn't help either. Don't get me wrong - that's not about money that's about stability. I just share my code since I think others might find it useful. If you really need PostgreSql support the only way to get it is to do it yourself. Of course I will help you when I can. Don't be afraid about doing it yourself - the problem seems to be one or two steps away from solution.

Back to problem: You can test if you have already psycopg installed by running python from command line and trying to run "import psycopg" in python prompt.

The main problem here is actually the python module you use for psql (can I use this short form for postgresql?). That module does not have some properties that are required by python-openid library (that's library on which this trac plugin is based).

comment:13 Changed 15 years ago by anonymous

Not installed...

Python 2.6 (r26:66714, Feb 3 2009, 20:52:03) [GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import psycopg

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named psycopg

import psycopg2

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named psycopg2

I will get back to you when the SAs have it installed.

Does your plugin reliable work with MySQL or Sybase? Those are the other RDBMS we have in our systems, however, we were trying to stick with PostgreSQL for Trac projects. Using a mixture of RDBMS with individual systems is not ideal. Just considering my options, so that I can know what to tell the DBAs about the issues that this problem presents.

Thanks.

comment:14 Changed 15 years ago by Dalius

I have used it myself with MySql and SQLite and have not experienced problems yet. Actually database support is not part of this plugin. Database support is part of python-openid library. This plugin is based on that library and if there could be problems about PostgreSQL that's going to be in the line where I have asked to add .cnx.cnx. .cnx.cnx just says to use connection directly for this plugin. There were some problems for MySQL and SQLite that required direct usage of connection.

About psycopg: it might be not enough that they install it. Trac must use that library (not plugin). I'm really interested what library you are using. In that case I could answer why it fails.

comment:15 Changed 15 years ago by eliot.lee@…

Okay, that library is installed and still getting the same error message. Replacing the method that Trac currently uses for connecting to PostgreSQL is not a solution, since it may break other Trac projects we have installed and working.

For now, we are abandoning the usage of your plugin and pursing a less ideal solution. As soon as you figure out a solution (which I am well aware will not be immediately forthcoming) that works with the core method of connecting to PostgreSQL (because it works fine out of the box), we will pursue using OpenID, but in the short-term we are simply going to open that Trac project to allow anonymous users to create, edit, and delete tickets.

Please feel free to reply to this ticket if you ever get PostgreSQL working with your plugin.

Thanks.

comment:16 Changed 15 years ago by Dalius

Resolution: invalid
Status: newclosed

What you mean by "core method". Since you are using python you must use one or another library. I am aware of two: psycopg and PyPgSQL. python-openid module should work with psycopg because it follows PEP-249 standard (http://www.python.org/dev/peps/pep-0249/). I don't know if other DB libraries follows PEP-249.

That means I can't fix your problem because of two reasons: 1) the problem is in python-openid module and not in my plugin; 2) you are using PostgreSQL library that doesn't work with python-openid module;

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Dalius.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.