[PyQt] PyQt4 and Stackless 2.5.2?

inhahe inhahe at gmail.com
Tue Jul 22 14:53:00 BST 2008


On Tue, Jul 22, 2008 at 8:45 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Tue, 22 Jul 2008 08:32:34 -0400, inhahe <inhahe at gmail.com> wrote:
>> Can anyone tell me how to get PyQt4 working with Stackless?
>>
>> I found this:
>>
>> ___________________________
>>
>>
>> Subject:      Re: [PyQt] PyQt4.3 and stackless python 2.5.1 working?Link to
>> this message
>> From: Michael Guntsche (mi... at it-loops.com)
>> Date: 08/28/2007 04:20:16 PM
>> List: org.kde.pykde
>>
>> On Aug 29, 2007, at 0:08, Michael Guntsche wrote:
>>
>> Hi list,
>>
>> I recently played around a little bit with stackless python and also
>> wanted to try it together with PyQt to see how lightweight threading
>> works. The problem is that it look like stackless and pyqt4 do not
>> like each other very much.
>>
>> Ok, answering my own mail here after searching through the stackless
>> mail archive. Changing siplib.c like explained here
>> http://article.gmane.org/ gmane.comp.python.stackless/2431 gave me a
>> working sip and pyqt with stackless python. I have not tested if this
>> breaks normal python but I thought I might post an answer to the list
>> in case someone else is looking for it.
>>
>> Kind regards, Micaehl
>>
>> ___________________________
>>
>>
>> But the link given is just a blank page now.
>
> The link contains an obvious typo.
>
>> So does anyone know what
>> change needs to be made to siplib.c?  Also, would I have to compile
>> SIP and PyQt4, or could I just compile SIP and use the PyQt4 Windows
>> binaries?  Because I already tried compiling PyQt4....it doesn't work.
>
> The change was made to SIP v4.7.1.
>
> Phil
>
>

Hmm, I have SIP 4.7.4, and I got an unhandled exception when importing
anything from PyQt, until I made that change in SIP.   Now I can
import without an exception, but I tried running a small sample app
and it gives me an unhandled exception.

here's the sample app

import os
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

def main():
    app = QApplication(sys.argv)
    w = MyWindow()
    w.show()
    sys.exit(app.exec_())

class MyWindow(QWidget):
    def __init__(self, *args):
        QWidget.__init__(self, *args)

        # create objects
        label = QLabel(self.tr("Enter command and press Return"))
        self.le = QLineEdit()
        self.te = QTextEdit()

        # layout
        layout = QVBoxLayout(self)
        layout.addWidget(label)
        layout.addWidget(self.le)
        layout.addWidget(self.te)
        self.setLayout(layout)

        # create connection
        self.connect(self.le, SIGNAL("returnPressed(void)"),
                     self.run_command)

    def run_command(self):
        cmd = str(self.le.text())
        stdouterr = os.popen4(cmd)[1].read()
        self.te.setText(stdouterr)

if __name__ == "__main__":
    main()

I also just upgraded to SIP 4.7.7, and it didn't help.  Although it
does appear that I can at least import without an exception with SIP
4.7.7.  Do I need to recompile and/or reinstall PyQt after changing
SIP?


More information about the PyQt mailing list