<font class="fixed_width" face="Courier, Monospaced">Hi, <br> </font><p><font class="fixed_width" face="Courier, Monospaced">I am having some serious problems with <b style="color: black; background-color: rgb(255, 255, 102);">
PyQT4</b>, <br> when i run pyqt script, I always get 'Segmentation <b style="color: black; background-color: rgb(160, 255, 255);">fault</b>'. <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">
the script is simple: <br> ====================== <br> %less qttest.py <br> from <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> import QtGui, QtCore <br> import sys <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">
if __name__ == '__main__': <br> app = QtGui.QApplication(sys.argv) <br> w = QtGui.QMainWindow() <br> w.show() <br> app.exec_() <br> ====================== <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">
When I run it , it crashes. <br> ====================== <br> %python qttest.py <br> Segmentation <b style="color: black; background-color: rgb(160, 255, 255);">fault</b> (core dumped) <br> ===================== <br> </font>
</p><p><font class="fixed_width" face="Courier, Monospaced">And the output with '-v' argument is : <br> ========================= <br> %python -v qttest.py <br> # installing zipimport hook <br> import zipimport # builtin
<br> # installed zipimport hook <br> # /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/ <br> site.py <br> import site # precompiled from /usr/local/lib/python2.4/site.pyc <br> # /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
<br> os.py <br> import os # precompiled from /usr/local/lib/python2.4/os.pyc <br> import posix # builtin <br> # /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/ <br> python2.4/posixp <br> ath.py <br> import posixpath # precompiled from /usr/local/lib/python2.4/
<br> posixpath.pyc <br> # /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/ <br> stat.py <br> import stat # precompiled from /usr/local/lib/python2.4/stat.pyc <br> # /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
<br> python2.4/UserDic <br> t.py <br> import UserDict # precompiled from /usr/local/lib/python2.4/ <br> UserDict.pyc <br> # /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/ <br> python2.4/copy_re <br> g.py <br>
import copy_reg # precompiled from /usr/local/lib/python2.4/ <br> copy_reg.pyc <br> # /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/ <br> types.py <br> import types # precompiled from /usr/local/lib/python2.4/types.pyc
<br> # /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/ <br> python2.4/warning <br> s.py <br> import warnings # precompiled from /usr/local/lib/python2.4/ <br> warnings.pyc <br> # /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/
<br> python2.4/lineca <br> che.py <br> import linecache # precompiled from /usr/local/lib/python2.4/ <br> linecache.pyc <br> import encodings # directory /usr/local/lib/python2.4/encodings <br> # /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/
<br> lib/python2 <br> .4/encodings/__init__.py <br> import encodings # precompiled from /usr/local/lib/python2.4/encodings/ <br> __init__. <br> pyc <br> # /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/
<br> codecs.py <br> import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc <br> import _codecs # builtin <br> # /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/ <br> lib/python2. <br> 4/encodings/aliases.py
<br> import encodings.aliases # precompiled from /usr/local/lib/python2.4/ <br> encodings/a <br> liases.pyc <br> # /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/ <br> python2.4 <br> /encodings/gb2312.py
<br> import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/ <br> encodings/gb <br> 2312.pyc <br> dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2); <br> import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
<br> lib- <br> dynload / <br> _codecs_cn.so <br> dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2); <br> import _multibytecodec # dynamically loaded from /usr/local/lib/
<br> python2.4/lib- <br> dy nload/ <br> _multibytecodec.so <br> Python 2.4.3 (#2, Oct 15 2006, 05:32:11) <br> [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 <br> Type "help", "copyright", "credits" or "license" for more information.
<br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> # directory /usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> <br> # /usr/local/lib/python2.4/site-packages/
<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>/__init__.pyc matches / <br> usr/local/ <br> l ib/ <br> python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/__init__.py <br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> # precompiled from /usr/local/lib/python2.4/site-packages/ <br> <b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/__i <br> nit__.pyc <br> dlopen("/usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>/QtGui.so", 2); <br> dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
<br> import sip # dynamically loaded from /usr/local/lib/python2.4/site- <br> packages/ <br> sip. so <br> dlopen("/usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtCore.so", 2); <br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>.QtCore # dynamically loaded from /usr/local/lib/python2.4/ <br> site-pack <br> ages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtCore.so <br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>.QtGui # dynamically loaded from /usr/local/lib/python2.4/ <br> site-packa <br> ges/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtGui.so <br> Segmentation <b style="color: black; background-color: rgb(160, 255, 255);">fault</b> (core dumped) <br> %python -v qttest.py <br> # installing zipimport hook <br> import zipimport # builtin <br> # installed zipimport hook
<br> # /usr/local/lib/python2.4/site.pyc matches /usr/local/lib/python2.4/ <br> site.py <br> import site # precompiled from /usr/local/lib/python2.4/site.pyc <br> # /usr/local/lib/python2.4/os.pyc matches /usr/local/lib/python2.4/
<br> os.py <br> import os # precompiled from /usr/local/lib/python2.4/os.pyc <br> import posix # builtin <br> # /usr/local/lib/python2.4/posixpath.pyc matches /usr/local/lib/ <br> python2.4/posixpath.py <br> import posixpath # precompiled from /usr/local/lib/python2.4/
<br> posixpath.pyc <br> # /usr/local/lib/python2.4/stat.pyc matches /usr/local/lib/python2.4/ <br> stat.py <br> import stat # precompiled from /usr/local/lib/python2.4/stat.pyc <br> # /usr/local/lib/python2.4/UserDict.pyc matches /usr/local/lib/
<br> python2.4/UserDict.py <br> import UserDict # precompiled from /usr/local/lib/python2.4/ <br> UserDict.pyc <br> # /usr/local/lib/python2.4/copy_reg.pyc matches /usr/local/lib/ <br> python2.4/copy_reg.py <br> import copy_reg # precompiled from /usr/local/lib/python2.4/
<br> copy_reg.pyc <br> # /usr/local/lib/python2.4/types.pyc matches /usr/local/lib/python2.4/ <br> types.py <br> import types # precompiled from /usr/local/lib/python2.4/types.pyc <br> # /usr/local/lib/python2.4/warnings.pyc matches /usr/local/lib/
<br> python2.4/warnings.py <br> import warnings # precompiled from /usr/local/lib/python2.4/ <br> warnings.pyc <br> # /usr/local/lib/python2.4/linecache.pyc matches /usr/local/lib/ <br> python2.4/linecache.py <br> import linecache # precompiled from /usr/local/lib/python2.4/
<br> linecache.pyc <br> import encodings # directory /usr/local/lib/python2.4/encodings <br> # /usr/local/lib/python2.4/encodings/__init__.pyc matches /usr/local/ <br> lib/python2.4/encodings/__init__.py <br> import encodings # precompiled from /usr/local/lib/python2.4/encodings/
<br> __init__.pyc <br> # /usr/local/lib/python2.4/codecs.pyc matches /usr/local/lib/python2.4/ <br> codecs.py <br> import codecs # precompiled from /usr/local/lib/python2.4/codecs.pyc <br> import _codecs # builtin <br> # /usr/local/lib/python2.4/encodings/aliases.pyc matches /usr/local/
<br> lib/python2.4/encodings/aliases.py <br> import encodings.aliases # precompiled from /usr/local/lib/python2.4/ <br> encodings/aliases.pyc <br> # /usr/local/lib/python2.4/encodings/gb2312.pyc matches /usr/local/lib/ <br>
python2.4/encodings/gb2312.py <br> import encodings.gb2312 # precompiled from /usr/local/lib/python2.4/ <br> encodings/gb2312.pyc <br> dlopen("/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so", 2); <br> import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/
<br> lib-dynload/_codecs_cn.so <br> dlopen("/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so", 2); <br> import _multibytecodec # dynamically loaded from /usr/local/lib/ <br> python2.4/lib-dynload/_multibytecodec.so
<br> Python 2.4.3 (#2, Oct 15 2006, 05:32:11) <br> [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 <br> Type "help", "copyright", "credits" or "license" for more information. <br> import
<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> # directory /usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> <br> # /usr/local/lib/python2.4/site-packages/
<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>/__init__.pyc matches / <br> usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>/__init__.py
<br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b> # precompiled from /usr/local/lib/python2.4/site-packages/ <br> <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>
/__init__.pyc <br> dlopen("/usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>/QtGui.so", 2); <br> dlopen("/usr/local/lib/python2.4/site-packages/sip.so", 2);
<br> import sip # dynamically loaded from /usr/local/lib/python2.4/site- <br> packages/sip.so <br> dlopen("/usr/local/lib/python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>
/QtCore.so", 2); <br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>.QtCore # dynamically loaded from /usr/local/lib/python2.4/ <br> site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtCore.so <br> import <b style="color: black; background-color: rgb(255, 255, 102);">PyQt4</b>.QtGui # dynamically loaded from /usr/local/lib/python2.4/ <br> site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtGui.so <br> Segmentation <b style="color: black; background-color: rgb(160, 255, 255);">fault</b> (core dumped) <br> ============================================= <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">
And the output of the gdb is : <br> =========================================== <br> %gdb --args python qttest.py <br> GNU gdb 6.1.1 [FreeBSD] <br> Copyright 2004 Free Software Foundation, Inc. <br> GDB is free software, covered by the GNU General Public License, and
<br> you are <br> welcome to change it and/or distribute copies of it under certain <br> conditions. <br> Type "show copying" to see the conditions. <br> There is absolutely no warranty for GDB. Type "show warranty" for
<br> details. <br> This GDB was configured as "i386-marcel-freebsd"...(no debugging <br> symbols found)... <br> (gdb) run <br> Starting program: /usr/local/bin/python qttest.py <br> (no debugging symbols found)...(no debugging symbols found)...(no
<br> debugging symbols found)...(no debugging symbols found)...warning: <br> Unable to get location for thread creation breakpoint: generic error <br> [New LWP 100113] <br> (no debugging symbols found)...(no debugging symbols found)...[New
<br> Thread 0x811f000 (LWP 100113)] <br> (no debugging symbols found)...(no debugging symbols found)...(no <br> debugging symbols found)... <br> Program received signal SIGSEGV, Segmentation <b style="color: black; background-color: rgb(160, 255, 255);">
fault</b>. <br> [Switching to Thread 0x811f000 (LWP 100099)] <br> 0x2887cb6d in typeinfo name for sipQApplication () from /usr/local/lib/ <br> python2.4/site-packages/<b style="color: black; background-color: rgb(255, 255, 102);">
PyQt4</b>/QtGui.so <br> (gdb) <br> ========================================== <br> </font></p><p><font class="fixed_width" face="Courier, Monospaced">My system is FreeBSD 6.2 release, i386, all softwares were installed <br>
from ports. <br> and the Qt4 examples/demos work perfectly. <br> </font></p><font class="fixed_width" face="Courier, Monospaced">It seems to have no useful hint at google.<br>Please help me. <br> Thanks very much in advance.
<br> Regards, <br> jiang.haiyun </font><br>-- <br>