By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,035 Members | 1,995 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,035 IT Pros & Developers. It's quick & easy.

Problem with PyQt4

P: n/a
Hi,

I am having some serious problems with PyQT4,
when i run pyqt script, I always get 'Segmentation fault'.

the script is simple:
======================
%less qttest.py
from PyQt4 import QtGui, QtCore
import sys

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
w = QtGui.QMainWindow()
w.show()
app.exec_()
======================

When I run it , it crashes.
======================
%python qttest.py
Segmentation fault (core dumped)
=====================

And the output with '-v' argument is :
=========================
%python -v qttest.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/
site.py
import site # precompiled from /usr/local/lib/python2.4/site.pyc
# /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
os.py
import os # precompiled from /usr/local/lib/python2.4/os.pyc
import posix # builtin
# /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/
python2.4/posixp
ath.py
import posixpath # precompiled from /usr/local/lib/python2.4/
posixpath.pyc
# /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/
stat.py
import stat # precompiled from /usr/local/lib/python2.4/stat.pyc
# /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
python2.4/UserDic
t.py
import UserDict # precompiled from /usr/local/lib/python2.4/
UserDict.pyc
# /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/
python2.4/copy_re
g.py
import copy_reg # precompiled from /usr/local/lib/python2.4/
copy_reg.pyc
# /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/
types.py
import types # precompiled from /usr/local/lib/python2.4/types.pyc
# /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/
python2.4/warning
s.py
import warnings # precompiled from /usr/local/lib/python2.4/
warnings.pyc
# /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/
python2.4/lineca
che.py
import linecache # precompiled from /usr/local/lib/python2.4/
linecache.pyc
import encodings # directory /usr/local/lib/python2.4/encodings
# /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/
lib/python2
..4/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.4/encodings/
__init__.
pyc
# /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/
codecs.py
import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/
lib/python2.
4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.4/
encodings/a
liases.pyc
# /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/
python2.4
/encodings/gb2312.py
import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/
encodings/gb
2312.pyc
dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2);
import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
lib-
dynload /
_codecs_cn.so
dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2);
import _multibytecodec # dynamically loaded from /usr/local/lib/
python2.4/lib-
dy nload/
_multibytecodec.so
Python 2.4.3 (#2, Oct 15 2006, 05:32:11)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
import PyQt4 # directory /usr/local/lib/python2.4/site-packages/PyQt4
# /usr/local/lib/python2.4/site-packages/PyQt4/__init__.pyc matches /
usr/local/
l ib/
python2.4/site-packages/PyQt4/__init__.py
import PyQt4 # precompiled from /usr/local/lib/python2.4/site-packages/
PyQt4/__i
nit__.pyc
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtGui.so", 2);
dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
import sip # dynamically loaded from /usr/local/lib/python2.4/site-
packages/
sip. so
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtCore.so", 2);
import PyQt4.QtCore # dynamically loaded from /usr/local/lib/python2.4/
site-pack
ages/PyQt4/QtCore.so
import PyQt4.QtGui # dynamically loaded from /usr/local/lib/python2.4/
site-packa
ges/PyQt4/QtGui.so
Segmentation fault (core dumped)
%python -v qttest.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/
site.py
import site # precompiled from /usr/local/lib/python2.4/site.pyc
# /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
os.py
import os # precompiled from /usr/local/lib/python2.4/os.pyc
import posix # builtin
# /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/
python2.4/posixpath.py
import posixpath # precompiled from /usr/local/lib/python2.4/
posixpath.pyc
# /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/
stat.py
import stat # precompiled from /usr/local/lib/python2.4/stat.pyc
# /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
python2.4/UserDict.py
import UserDict # precompiled from /usr/local/lib/python2.4/
UserDict.pyc
# /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/
python2.4/copy_reg.py
import copy_reg # precompiled from /usr/local/lib/python2.4/
copy_reg.pyc
# /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/
types.py
import types # precompiled from /usr/local/lib/python2.4/types.pyc
# /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/
python2.4/warnings.py
import warnings # precompiled from /usr/local/lib/python2.4/
warnings.pyc
# /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/
python2.4/linecache.py
import linecache # precompiled from /usr/local/lib/python2.4/
linecache.pyc
import encodings # directory /usr/local/lib/python2.4/encodings
# /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/
lib/python2.4/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.4/encodings/
__init__.pyc
# /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/
codecs.py
import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/
lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.4/
encodings/aliases.pyc
# /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/
python2.4/encodings/gb2312.py
import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/
encodings/gb2312.pyc
dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2);
import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
lib-dynload/_codecs_cn.so
dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2);
import _multibytecodec # dynamically loaded from /usr/local/lib/
python2.4/lib-dynload/_multibytecodec.so
Python 2.4.3 (#2, Oct 15 2006, 05:32:11)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
import PyQt4 # directory /usr/local/lib/python2.4/site-packages/PyQt4
# /usr/local/lib/python2.4/site-packages/PyQt4/__init__.pyc matches /
usr/local/lib/python2.4/site-packages/PyQt4/__init__.py
import PyQt4 # precompiled from /usr/local/lib/python2.4/site-packages/
PyQt4/__init__.pyc
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtGui.so", 2);
dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
import sip # dynamically loaded from /usr/local/lib/python2.4/site-
packages/sip.so
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtCore.so", 2);
import PyQt4.QtCore # dynamically loaded from /usr/local/lib/python2.4/
site-packages/PyQt4/QtCore.so
import PyQt4.QtGui # dynamically loaded from /usr/local/lib/python2.4/
site-packages/PyQt4/QtGui.so
Segmentation fault (core dumped)
=============================================

And the output of the gdb is :
===========================================
%gdb --args python qttest.py
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging
symbols found)...
(gdb) run
Starting program: /usr/local/bin/python qttest.py
(no debugging symbols found)...(no debugging symbols found)...(no
debugging symbols found)...(no debugging symbols found)...warning:
Unable to get location for thread creation breakpoint: generic error
[New LWP 100113]
(no debugging symbols found)...(no debugging symbols found)...[New
Thread 0x811f000 (LWP 100113)]
(no debugging symbols found)...(no debugging symbols found)...(no
debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x811f000 (LWP 100099)]
0x2887cb6d in typeinfo name for sipQApplication () from /usr/local/lib/
python2.4/site-packages/PyQt4/QtGui.so
(gdb)
==========================================

My system is FreeBSD 6.2 release, i386, all softwares were installed
from ports.
and the Qt4 examples/demos work perfectly.

Please help me.
Thanks very much in advance.
Regards,
jiang.haiyun

Apr 30 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I rebuild them from source now.
Hope this can help me.

May 1 '07 #2

P: n/a
On Apr 30, 10:32 pm, "jiang.hai...@gmail.com" <jiang.hai...@gmail.com>
wrote:
Hi,

I am having some serious problems with PyQT4,
when i run pyqt script, I always get 'Segmentation fault'.

the script is simple:
======================
%less qttest.py
from PyQt4 import QtGui, QtCore
import sys

if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
w = QtGui.QMainWindow()
w.show()
app.exec_()
======================

When I run it , it crashes.
======================
%python qttest.py
Segmentation fault (core dumped)
=====================

And the output with '-v' argument is :
=========================
%python -v qttest.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/
site.py
import site # precompiled from /usr/local/lib/python2.4/site.pyc
# /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
os.py
import os # precompiled from /usr/local/lib/python2.4/os.pyc
import posix # builtin
# /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/
python2.4/posixp
ath.py
import posixpath # precompiled from /usr/local/lib/python2.4/
posixpath.pyc
# /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/
stat.py
import stat # precompiled from /usr/local/lib/python2.4/stat.pyc
# /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
python2.4/UserDic
t.py
import UserDict # precompiled from /usr/local/lib/python2.4/
UserDict.pyc
# /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/
python2.4/copy_re
g.py
import copy_reg # precompiled from /usr/local/lib/python2.4/
copy_reg.pyc
# /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/
types.py
import types # precompiled from /usr/local/lib/python2.4/types.pyc
# /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/
python2.4/warning
s.py
import warnings # precompiled from /usr/local/lib/python2.4/
warnings.pyc
# /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/
python2.4/lineca
che.py
import linecache # precompiled from /usr/local/lib/python2.4/
linecache.pyc
import encodings # directory /usr/local/lib/python2.4/encodings
# /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/
lib/python2
.4/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.4/encodings/
__init__.
pyc
# /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/
codecs.py
import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/
lib/python2.
4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.4/
encodings/a
liases.pyc
# /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/
python2.4
/encodings/gb2312.py
import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/
encodings/gb
2312.pyc
dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2);
import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
lib-
dynload /
_codecs_cn.so
dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2);
import _multibytecodec # dynamically loaded from /usr/local/lib/
python2.4/lib-
dy nload/
_multibytecodec.so
Python 2.4.3 (#2, Oct 15 2006, 05:32:11)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
import PyQt4 # directory /usr/local/lib/python2.4/site-packages/PyQt4
# /usr/local/lib/python2.4/site-packages/PyQt4/__init__.pyc matches /
usr/local/
l ib/
python2.4/site-packages/PyQt4/__init__.py
import PyQt4 # precompiled from /usr/local/lib/python2.4/site-packages/
PyQt4/__i
nit__.pyc
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtGui.so", 2);
dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
import sip # dynamically loaded from /usr/local/lib/python2.4/site-
packages/
sip. so
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtCore.so", 2);
import PyQt4.QtCore # dynamically loaded from /usr/local/lib/python2.4/
site-pack
ages/PyQt4/QtCore.so
import PyQt4.QtGui # dynamically loaded from /usr/local/lib/python2.4/
site-packa
ges/PyQt4/QtGui.so
Segmentation fault (core dumped)
%python -v qttest.py
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/
site.py
import site # precompiled from /usr/local/lib/python2.4/site.pyc
# /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
os.py
import os # precompiled from /usr/local/lib/python2.4/os.pyc
import posix # builtin
# /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/
python2.4/posixpath.py
import posixpath # precompiled from /usr/local/lib/python2.4/
posixpath.pyc
# /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/
stat.py
import stat # precompiled from /usr/local/lib/python2.4/stat.pyc
# /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
python2.4/UserDict.py
import UserDict # precompiled from /usr/local/lib/python2.4/
UserDict.pyc
# /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/
python2.4/copy_reg.py
import copy_reg # precompiled from /usr/local/lib/python2.4/
copy_reg.pyc
# /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/
types.py
import types # precompiled from /usr/local/lib/python2.4/types.pyc
# /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/
python2.4/warnings.py
import warnings # precompiled from /usr/local/lib/python2.4/
warnings.pyc
# /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/
python2.4/linecache.py
import linecache # precompiled from /usr/local/lib/python2.4/
linecache.pyc
import encodings # directory /usr/local/lib/python2.4/encodings
# /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/
lib/python2.4/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.4/encodings/
__init__.pyc
# /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/
codecs.py
import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/
lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.4/
encodings/aliases.pyc
# /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/
python2.4/encodings/gb2312.py
import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/
encodings/gb2312.pyc
dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2);
import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
lib-dynload/_codecs_cn.so
dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2);
import _multibytecodec # dynamically loaded from /usr/local/lib/
python2.4/lib-dynload/_multibytecodec.so
Python 2.4.3 (#2, Oct 15 2006, 05:32:11)
[GCC 3.4.6 [FreeBSD] 20060305] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
import PyQt4 # directory /usr/local/lib/python2.4/site-packages/PyQt4
# /usr/local/lib/python2.4/site-packages/PyQt4/__init__.pyc matches /
usr/local/lib/python2.4/site-packages/PyQt4/__init__.py
import PyQt4 # precompiled from /usr/local/lib/python2.4/site-packages/
PyQt4/__init__.pyc
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtGui.so", 2);
dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
import sip # dynamically loaded from /usr/local/lib/python2.4/site-
packages/sip.so
dlopen("/usr/local/lib/python2.4/site-packages/PyQt4/QtCore.so", 2);
import PyQt4.QtCore # dynamically loaded from /usr/local/lib/python2.4/
site-packages/PyQt4/QtCore.so
import PyQt4.QtGui # dynamically loaded from /usr/local/lib/python2.4/
site-packages/PyQt4/QtGui.so
Segmentation fault (core dumped)
=============================================

And the output of the gdb is :
===========================================
%gdb --args python qttest.py
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging
symbols found)...
(gdb) run
Starting program: /usr/local/bin/python qttest.py
(no debugging symbols found)...(no debugging symbols found)...(no
debugging symbols found)...(no debugging symbols found)...warning:
Unable to get location for thread creation breakpoint: generic error
[New LWP 100113]
(no debugging symbols found)...(no debugging symbols found)...[New
Thread 0x811f000 (LWP 100113)]
(no debugging symbols found)...(no debugging symbols found)...(no
debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x811f000 (LWP 100099)]
0x2887cb6d in typeinfo name for sipQApplication () from /usr/local/lib/
python2.4/site-packages/PyQt4/QtGui.so
(gdb)
==========================================

My system is FreeBSD 6.2 release, i386, all softwares were installed
from ports.
and the Qt4 examples/demos work perfectly.

Please help me.
Thanks very much in advance.
Regards,jiang.haiyun
I have rebuilded the PyQt4 from source, but the problem seems to be
remaining.
And I notice the notes for gettext on http://www.freshports.org/devel/gettext/:
It says:
"As a result of the upgrade to gettext-0.16.1, the shared library
version
of libintl has changed, so you will need to rebuild all ports that
depend on gettext (ie: most of them, sorry):
portupgrade -rf gettext
"
and PyQT4 have some dependence on gettext.

Last night, I portupgraded gettext(it took a long time, though)
and now the problem has disappeared. I tested the example script
tetrix.py, it ran smoothly.

Before portupgrade gettext, I have got a runtime error something like
"shared library libintl.so.8 not found"(the system only has the
libintl.so.6 that time) when ran PyQT4 script, and this was caused by
the lower version of gettext, so I deleted it and reinstalled
gettext0.16.1_1, then libintl.so.6 was replaces by libintl.so.8. But
some other programs complained that they can't find libintl.so.6, so
I linked libintl.so.8 to libintl.so.6.
At that point, I got the preceding problem(PyQT4 script always
crashes).
So I think the problem may be caused by 'PyQt4' mismatches 'gettext'.
And there may be a simple solution :)

regards,
jiang.haiyun

May 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.