segfault with small pyqt script

Hans-Peter Jansen hpj at urpla.net
Sun Aug 15 17:17:13 EDT 2010


On Thursday 12 August 2010, 01:07:25 Gelonida wrote:
> Hi Guys,
> I'm desperate. I'm having a real application, which fails rather often
> when finishing it. I'm not sure, whether any serious problem could be
> hidden behind it
>
> The script is a pyqt script, which segfaults most of the time on my
> ubuntu 10.4 linux 64 bit and I'm having trouble to understand why.
>
> Trying to create the smallest possible test case I ended up with
> following script, which I named dodo.py and which i made executable with
> chmod +x ./dodo.py
>
> #!/usr/bin/env python
> from PyQt4.QtGui import
> QDialog,QGridLayout,QLabel,QComboBox,QPushButton,QApplication
> a = "one"
> b = "unused"
> c = "also unused"
> d= "ans also unused"
> e = "another var"
> f = "something"
> class MyForm(QDialog):
>     def __init__(self,parent=None,config=None,ini_info=None):
>         super(MyForm,self).__init__(parent=parent)
>         grid = QGridLayout()
>         quit_btn = QPushButton("Quit")
>         quit_btn.clicked.connect(self.quit)
>         grid.addWidget(quit_btn,0,0)
>         name = "a_name"
>         vals_box = QComboBox()
>         vals_box.addItem("one")
>         vals_box.addItem("two")
>         grid.addWidget(vals_box,0,1)
>         self.setLayout(grid)
>     def quit(self):
>         self.close()
> if __name__ == "__main__":
>     app = QApplication([])
>     myform = MyForm()
>     myform.show()
>     retcode = app.exec_()
>     print "last"
>
>
>
> In order to perform the test several times I typed on the command line:
>
> a="" ; while [ "$a" = "" ] ; do ./dodo.py ; read -t 1 a ; done
>
> As soon as the window shows up
> I click twice (slowly ) on 'one' and then on quit.

For a starter, tell us the versions of python-sip, and python-qt4 or however 
they're called in Ubuntu. For the record, 
python-sip-4.10.5-1.1
python-qt4-4.7.4-1.1
doesn't show this behavior.

Pete



More information about the Python-list mailing list