adodbapi error in TG

61 views
Skip to first unread message

Jim Steil

unread,
Jun 26, 2007, 12:11:17 PM6/26/07
to turbo...@googlegroups.com
Hi, I'm taking a shot in the dark and hoping someone else has seen this
situation before. I have a report that sits in a separate module that I
call from a TG subcontroller. When I run this report outside of TG, it
works fine. When I run it from my TG app, I get the following:

Traceback (most recent call last):
File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py", line 105, in _run
self.main()
File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\identity\conditions.py", line 275, in _wrapper
return fn( *args, **kw )
File "<string>", line 3, in ingredientReceivingReport
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\controllers.py", line 334, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\database.py", line 302, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\controllers.py", line 351, in <lambda>
mapping, fragment, args, kw)))
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\controllers.py", line 378, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\errorhandling.py", line 73, in try_call
return func(self, *args, **kw)
File "<string>", line 3, in ingredientReceivingReport
File "C:\Python24\lib\site-packages\turbogears-1.0.1-py2.4.egg\turbogears\identity\conditions.py", line 235, in require
return fn(self, *args, **kwargs)
File "C:\PyWork\TurboGears\motion\motion\subcontrollers\report.py", line 356, in ingredientReceivingReport
ir.ingredientRcvDetailReport(letters_file, fromDate, toDate, plantId, userId)
File "C:\PyWork\TurboGears\motion\motion\utility\ingredientRcvDetailReport.py", line 223, in ingredientRcvDetailReport
aconn=adodbapi.connect('PROVIDER=IBMDA400; DATA SOURCE=host;USER ID=zzzzzz;PASSWORD=yyyyyy')
File "C:\Python24\Lib\site-packages\adodbapi\adodbapi.py", line 216, in connect
raise InterfaceError #Probably COM Error
InterfaceError: <function _wrapper at 0x021CCDF0>

Also, this used to work, just stopped this week. It stopped working in
my test and production environments, but still works on both machines
from the command line. I haven't made any changes to my Python or TG
setup. Anything obvious I'm overlooking?

-Jim

Paul Johnston

unread,
Jun 27, 2007, 4:22:48 AM6/27/07
to turbo...@googlegroups.com
Jim,

I've had some problems with adodbapi, which came down to it not calling the COM CoInitialize method. I found as well that the original exception was masked by some try/except clauses, resulting in a generic message like you encountered. A little annoying as the original exception was completely specific about the problem; I could have diagnosed it straight away.

Anyway, as a solution you can put a CoInitialize call in. Alternatively, if your using SQLAlchemy, use pyODBC instead of adodbapi - experience shows this is much more reliable.

Paul


On 6/26/07, Jim Steil <st...@mailbag.com> wrote:

Hi, I'm taking a shot in the dark and hoping someone else has seen this
situation before.  I have a report that sits in a separate module that I
call from a TG subcontroller.  When I run this report outside of TG, it
works fine.  When I run it from my TG app, I get the following:

Traceback (most recent call last):
  File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py", line 105, in _run
    self.main()
  File "C:\Python24\lib\site-packages\cherrypy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "C:\Python24\lib\site-packages\turbogears- 1.0.1-py2.4.egg\turbogears\identity\conditions.py", line 275, in _wrapper

    return fn( *args, **kw )
  File "<string>", line 3, in ingredientReceivingReport
  File "C:\Python24\lib\site-packages\turbogears- 1.0.1-py2.4.egg\turbogears\controllers.py", line 334, in expose

    output = database.run_with_transaction(
  File "<string>", line 5, in run_with_transaction
  File "C:\Python24\lib\site-packages\turbogears- 1.0.1-py2.4.egg\turbogears\database.py", line 302, in so_rwt

Jim Steil

unread,
Jun 28, 2007, 1:33:49 PM6/28/07
to turbo...@googlegroups.com
Paul:  Thanks for that info.  pyODBC is exactly what I've been looking for, don't know why I didn't find it sooner.  I switched the connection and now it is working perfectly.

    -Jim
Reply all
Reply to author
Forward
0 new messages