[Twisted-Python] qt5 / twisted integration....reactor imported but NameError?
python main_code.py Gtk-Message: Failed to load module "canberra-gtk-module" testing... [Failure instance: Traceback: <type 'exceptions.NameError'>: global name 'reactor' is not defined /home/julius/.local/lib/python2.7/site-packages/twisted/internet/tcp.py:293:connectionLost /home/julius/.local/lib/python2.7/site-packages/twisted/web/client.py:222:connectionLost /home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py:393:callback /home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py:501:_startRunCallbacks --- <exception caught here> --- /home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py:588:_runCallbacks /home/julius/code/python/qt5-python2.x/webchat.py:75:main_page_result ] 123 main_code looks like this: from PyQt5 import QtWidgets import sys from untitled import Ui_MainWindow class Main(QtWidgets.QMainWindow): def __init__(self): QtWidgets.QMainWindow.__init__(self) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.setupSignals() def button_1_Clicked(self): self.ui.textbox_2.setText(self.ui.textbox_1.text()) def setupSignals(self): #self.ui.textbox_1.textChanged.connect(self.textbox_1_Changed) self.ui.button_1.clicked.connect(self.button_1_Clicked) if __name__ == '__main__': #app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv) # your code to init QtCore import qt5reactor qt5reactor.install() from twisted.internet import reactor print "testing..." <snip> from webchat import get_main_page get_main_page() reactor.run() as you can see the qt5reactor.install() runs before the "from webchat import get_main_page" so how come that webchat does not know about reactor?
participants (1)
-
steven meier