I am working on two projects that are bothing running under mod_wsgi.
The first is using kinterbasdb directly (no sqlalchemy).
The second is using sqlalchemy.
Problem arises when one or the other attempts to call kinterbasdb.init
after the other one has already done so.
My question is this:
When sqlalchemy attempts to initialize kinterbasdb, it appears to be
calling it with:
def create_connect_args(self, url):
...
global _initialized_kb
        if not _initialized_kb and self.dbapi is not None:
            _initialized_kb = True
            self.dbapi.init(type_conv=type_conv,
concurrency_level=concurrency_level)
If kinterbasdb has already been intialized this is supposed to
immediately throw a ProgrammingError.
But the programming error is getting thrown when it attempts
_k.concurrency_level_set(concurrency_level)

Could importing kinterbasdb inside databases.firebird.py and referring
to it as dbapi during the call to init be causing this?  Anyone with
more experience able to express this better?

Following is the stack trace of the ProgrammingError...

[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
cherrypy.server.start(init_only=True, server_class=None)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/cherrypy/_cpserver.py", line 72, in start
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
Engine.start(self)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/cherrypy/_cpengine.py", line 106, in start
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
self._start()
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/cherrypy/_cpserver.py", line 78, in _start
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
Engine._start(self)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/cherrypy/_cpengine.py", line 110, in
_start
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]     func()
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/turbogears/startup.py", line 227, in
startTurboGears
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
database.get_engine()
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/turbogears/database.py", line 45, in
get_engine
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]     _engine =
sqlalchemy.create_engine(dburi, **alch_args)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/sqlalchemy/engine/__init__.py", line 173,
in create_engine
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]     return
strategy.create(*args, **kwargs)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/sqlalchemy/engine/strategies.py", line 70,
in create
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]     (cargs,
cparams) = dialect.create_connect_args(u)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/sqlalchemy/databases/firebird.py", line
294, in create_connect_args
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
self.dbapi.init(type_conv=type_conv,
concurrency_level=concurrency_level)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]   File "/usr/
lib/python2.4/site-packages/kinterbasdb/__init__.py", line 272, in
init
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
_k.concurrency_level_set(concurrency_level)
[Fri Sep 26 11:46:01 2008] [error] [client 10.47.52.244]
ProgrammingError: (0, 'The concurrency level cannot be changed once it
has been set.  Use kinterbasdb.init(concurrency_level=?) to set the c
oncurrency level legally.')


Throwing a try/except around the call to _k.concurrency_level_set in
kinterbasdb.__init__ gets things up and running, but I am
uncomfortable swallowing exceptions like that.  Very uncomfortable.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to