[Twisted-Python] How to get callback return value

杨有秀 yangyouxiu at gmail.com
Tue Dec 3 05:00:30 MST 2013


Thanks very much. Following is the traceback message and source code.

=> Traceback (most recent call last):
  File "/home/20131203-Client/src/NodeConfigurator.py", line 250, in
__slotSelectionChanged
    self.__showConfigurationPage(last_item,  0)
  File "/home/20131203-Client/src/NodeConfigurator.py", line 294, in
__showConfigurationPage
    self.showConfigurationPageByName(itm)
  File "/home/20131203-Client/src/NodeConfigurator.py", line 345, in
showConfigurationPageByName
    page.loadConfig(itm.getIDs()[0],  itm.tmpConfig)
  File "/home/20131203-Client/src/Ui/ConfigurationPages/Page_Circle.py",
line 125, in loadConfig
    self.textLabel_Platform.setText(platform)
TypeError: QLabel.setText(QString): argument 1 has unexpected type
'NoneType'
1111fff
Circle

Source code:
/home/20131203-Client/src/Ui/ConfigurationPages/Page_Circle.py

def loadConfig(self, id, config = None):
        """ Load the config
        """

        platform = node.get_platform()
self.textLabel_Platform.setText(platform)


/home/20131203-Client/src/node.py

def get_platform(self):
        """ Returns node type
        """

        self.node.addCallback(self.get_model)
        self.node.addCallback(self.success)
        return self.model


    def get_model(self, object):
        model=object.callRemote("getModel")
        return model

    def success(self, model):
        print '1111fff'
        print model
        self.model=model
        return self.model




2013/12/3 Daniel Sank <sank.daniel at gmail.com>

> The code you included in your email doesn't make sense. Please include
> a full working (with errors) code sample and then people can help you.
>
> Also, I _highly_ recommend that you read this:
>
> http://krondo.com/?page_id=1327
>
> It might as well be considered the official n00b intro to Twisted, imho.
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20131203/b4bcff21/attachment-0002.html>


More information about the Twisted-Python mailing list