Re: [Quickfix-users] Fwd: exception thrown in python with twisted logging
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2006-09-26 05:26:52
|
This is apparently the default behavior of Swig when it receives a python exception from a callback. It doesn't know what to do so it simply throws an DirectorMethodException and quits. It is telling you that something went wrong, but does not provide any sort of reasonable feedback to help you figure out what it is. The callback methods which handle exceptions already deal with this, however we did not think to handle the case where a callback method might throw an exception even when we were not expecting one. I've checked in a fix for this. Now when this happens, the actual python message will be printed out for you just as it would in a normal python application. Running your example code in onCreate, I now get this: Traceback (most recent call last): File "../examples/executor/python/executor.py", line 11, in onCreate print "SessionID = " + sessionID TypeError: cannot concatenate 'str' and 'SessionID' objects I'm guessing your other director exceptions are caused by similar python exceptions being thrown from the callbacks. If you get the latest from svn, you will be able to see the real exceptions that are causing the application to break. Also, is there a method in python that needs to be implemented on the SessionID object to make what you are doing legal? Something that will automatically convert an object to a string during concatenation? If so, we can implement it for all our serializable objects. Doing just print sessionID seems legal, so the print method seems to be converting to a string automatically. --oren On Sep 25, 2006, at 3:08 PM, Robert Parrott wrote: > I'm using the python binding from quickfix 1.12.4, and seeing a > possible bug in the python interface to the Application class. The > platform is CentOS 4.4 (equiv to RHEL 4, update 4). > > class MyApplication(quickfix.Application): > > def onCreate(self, sessionID): print "Session ID = " + sessionID > > throws an exception when called: "terminate called after throwing an > instance of 'Swig::DirectorMethodException' ". However, calling > sessionID.toString() here instead works. |