[Twisted-Python] wxpython and xmlrpc via twisted
I'm trying to create a taskbar app (in wxpython) to monitor job progress on a render farm. I'd like the taskbar app to have an xmlrpc server built in so that other applications can inform the taskbar app additional jobs to monitor. I found this recipe online which is a great example of the functionality I want: http://code.activestate.com/recipes/298985/ However when I run the following from xmlrpclib import * s = ServerProxy('http://localhost:7080') # Get access to xmlrpc server s.title('Hallo xmlrpc app') I don't get a response (though the title in the window changes - so I know it got it) I do get this though: Traceback (most recent call last): File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\protocols\basic.py", line 239, in dataReceived return self.rawDataReceived(data) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\http.py", line 1117, in rawDataReceived self.allContentReceived() File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\http.py", line 1108, in allContentReceived req.requestReceived(command, path, version) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\http.py", line 626, in requestReceived self.process() --- <exception caught here> --- File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\server.py", line 150, in process self.render(resrc) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\server.py", line 157, in render body = resrc.render(self) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\resource.py", line 189, in render return m(request) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\xmlrpc.py", line 122, in render_POST function = self._getFunction(functionPath) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\xmlrpc.py", line 170, in _getFunction handler = self.getSubHandler(prefix) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\xmlrpc.py", line 107, in getSubHandler return self.subHandlers.get(prefix, None) exceptions.AttributeError: 'MyXMLRPCApp' object has no attribute 'subHandlers' Unhandled error in Deferred: Traceback (most recent call last): File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\resource.py", line 189, in render return m(request) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\xmlrpc.py", line 126, in render_POST defer.maybeDeferred(function, *args).addErrback( File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\internet\defer.py", line 195, in addCallback callbackKeywords=kw) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\internet\defer.py", line 186, in addCallbacks self._runCallbacks() --- <exception caught here> --- File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\internet\defer.py", line 328, in _runCallbacks self.result = callback(self.result, *args, **kw) File "d:\toolkit\sww\win32\python\2.4\lib\site-packages\twisted-8.1.0-py2.4-win32.egg\twisted\web\xmlrpc.py", line 144, in _cbRender allow_none=self.allowNone) exceptions.AttributeError: 'MyXMLRPCApp' object has no attribute 'allowNone' I'm assuming this is just a good example that is out of date. However I'm not sure how to update it so that it works. Can someone help me out?
On Tue, 9 Dec 2008 15:27:00 -0800, Ian Jones
I'm trying to create a taskbar app (in wxpython) to monitor job progress on a render farm. I'd like the taskbar app to have an xmlrpc server built in so that other applications can inform the taskbar app additional jobs to monitor.
I found this recipe online which is a great example of the functionality I want:
http://code.activestate.com/recipes/298985/
However when I run the following
[snip]
I'm assuming this is just a good example that is out of date. However I'm not sure how to update it so that it works. Can someone help me out?
It looks like the direct cause of the problem is that the XMLRPC subclass in the example prevents XMLRPC.__init__ from being invoked. It seems to be doing this by subclassing both wx.App and XMLRPC. There's probably no good reason to subclass both of these, and in this case it's causing a problem, as presumably wx.App has an __init__ which is getting in the way. Jean-Paul
"There's probably no good reason to subclass both of these"
I'm relatively new to python so sorry if this should be obvious - but
how else would I get the functionality of both classes if I did
subclass both of them?
Ian
On Tue, Dec 9, 2008 at 4:08 PM, Jean-Paul Calderone
On Tue, 9 Dec 2008 15:27:00 -0800, Ian Jones
wrote: I'm trying to create a taskbar app (in wxpython) to monitor job progress on a render farm. I'd like the taskbar app to have an xmlrpc server built in so that other applications can inform the taskbar app additional jobs to monitor.
I found this recipe online which is a great example of the functionality I want:
http://code.activestate.com/recipes/298985/
However when I run the following
[snip]
I'm assuming this is just a good example that is out of date. However I'm not sure how to update it so that it works. Can someone help me out?
It looks like the direct cause of the problem is that the XMLRPC subclass in the example prevents XMLRPC.__init__ from being invoked. It seems to be doing this by subclassing both wx.App and XMLRPC. There's probably no good reason to subclass both of these, and in this case it's causing a problem, as presumably wx.App has an __init__ which is getting in the way.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
didn't subclass both of them rather.
On Wed, Dec 10, 2008 at 8:54 AM, Ian Jones
"There's probably no good reason to subclass both of these"
I'm relatively new to python so sorry if this should be obvious - but how else would I get the functionality of both classes if I did subclass both of them?
Ian
On Tue, Dec 9, 2008 at 4:08 PM, Jean-Paul Calderone
wrote: On Tue, 9 Dec 2008 15:27:00 -0800, Ian Jones
wrote: I'm trying to create a taskbar app (in wxpython) to monitor job progress on a render farm. I'd like the taskbar app to have an xmlrpc server built in so that other applications can inform the taskbar app additional jobs to monitor.
I found this recipe online which is a great example of the functionality I want:
http://code.activestate.com/recipes/298985/
However when I run the following
[snip]
I'm assuming this is just a good example that is out of date. However I'm not sure how to update it so that it works. Can someone help me out?
It looks like the direct cause of the problem is that the XMLRPC subclass in the example prevents XMLRPC.__init__ from being invoked. It seems to be doing this by subclassing both wx.App and XMLRPC. There's probably no good reason to subclass both of these, and in this case it's causing a problem, as presumably wx.App has an __init__ which is getting in the way.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Wed, 10 Dec 2008 08:54:49 -0800, Ian Jones
"There's probably no good reason to subclass both of these"
I'm relatively new to python so sorry if this should be obvious - but how else would I get the functionality of both classes if I did subclass both of them?
Create two classes and let instances of one keep references to an instance of the other. For example, in this case, you might have a wx.App subclass with the OnInit method defined in the example and a different XMLRPC subclass with a reference to instances of the first class. Then, instead of doing `self.frame.Close()´ or `self.frame.SetTitle(x)´, it would do `self.appObj.frame.Close()´ or `self.appObj.frame.SetTitle(x)´. Jean-Paul
participants (2)
-
Ian Jones
-
Jean-Paul Calderone