[Zope] Stopping error messages in an external method

Joe Goldthwaite joe at goldthwaites.com
Mon Nov 8 18:04:54 EST 2004


I've got a strange problem.  It may not be Zope related but it only happens
when my code is running under Zope.

I'm using Win32com to create an OleDB connection to my database. (Don't ask
why - it's a long story.  Lets just say that MS SQL has problem working with
remote tables when accessed through ODBC.)

My routine executes a stored procedure step-by-step and displays the status
of each step to the user.  I'm returning the status with the RESPONSE.write
method.  This works great most of the time.  I've noticed that if I put any
print statements in my code that print to the standard device, it seems to
confuse Zope.  I've read that you want to either return a value from the
external method or use RESPONSE.write but not both.

I think the problem is that the OleDB execute method is printing an error
message to the standard device.  I'm using try:except: to trap any errors.
When I run the code in the WingIDE, everything is fine.  When I run it in
Zope, it hangs when it hits the first error.  I know the code hangs because
I put some file write statements in the loop.  When I run it under the
debugger, I get a complete log.  If I run it under Zope, the log ends when
it hits the first error.

Anyone know what I'm missing here?

Thanks,

Joe Goldthwaite



More information about the Zope mailing list