I am defining multiple classes (some of them are threads) I have been writing Python programs for a few months, but never faced this issue so far unless I am doing something different inadvertently. The only difference I see is that I am calling the methods belonging to other classes, from a class which is also a thread. I see the following error:
AttributeError: 'Ui_MainWindow' object has no attribute 'textEdit_fwcmdlineoutput' Code Snippets: class Ui_MainWindow(object): [snip] def setStdoutToTextEditWindowFw(self): self.textEdit_fwcmdlineoutput.setText( sys.stdout.getvalue() ) sys.stdout = self.oldstdout Calling the above method from within the class works fine. But I am calling it from another class as below: class bcThread(threading.Thread): def __init__(self, cmd): threading.Thread.__init__(self) self.cmd = cmd def run(self): [snip] Ui_MainWindow.setStdoutToTextEditWindowFw(Ui_MainWindow) The highlighted line gives the following error : Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.2/threading.py", line 740, in _bootstrap_inner self.run() File "bc_reports_tab.py", line 1299, in run Ui_MainWindow.setStdoutToTextEditWindowFw(Ui_MainWindow) File "bc_reports_tab.py", line 465, in setStdoutToTextEditWindowFw self.textEdit_fwcmdlineoutput.setText( sys.stdout.getvalue() ) AttributeError: type object 'Ui_MainWindow' has no attribute 'textEdit_fwcmdlineoutput' I also tried many different ways of calling the method. The highlighted line is one of them. Another one I tried is here where I create an instance, which also gives the same error: x = Ui_MainWindow() x.setStdoutToTextEditWindowFw() I see the same error. Can someone guide me as to what is the correct way to do something like this? Thanks in advance. -SM
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor