<br><br>
<div><span class="gmail_quote">2007/5/1, haiyun jiang &lt;<a href="mailto:jiang.haiyun@gmail.com">jiang.haiyun@gmail.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><font face="Courier, Monospaced">Hi, <br></font>
<p><font 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 &#39;Segmentation <b style="COLOR: black; BACKGROUND-COLOR: rgb(160,255,255)">
fault</b>&#39;. <br></font></p>
<p><font 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 face="Courier, Monospaced">if __name__ == &#39;__main__&#39;: <br>&nbsp; &nbsp; &nbsp; &nbsp; app = QtGui.QApplication(sys.argv) <br>&nbsp; &nbsp; &nbsp; &nbsp; w = QtGui.QMainWindow() <br>&nbsp; &nbsp; &nbsp; &nbsp; w.show() <br>&nbsp; &nbsp; &nbsp; &nbsp; app.exec_() <br>====================== 
<br></font></p>
<p><font 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 face="Courier, Monospaced">And the output with &#39;-v&#39; 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(&quot;/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so&quot;, 2); 
<br>import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/ <br>lib- <br>dynload &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; / <br>_codecs_cn.so <br>dlopen(&quot;/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so&quot;, 2); 
<br>import _multibytecodec # dynamically loaded from /usr/local/lib/ <br>python2.4/lib- <br>dy &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; 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 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 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(&quot;/usr/local/lib/python2.4/site-packages/<b style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">PyQt4</b>/QtGui.so&quot;, 2); <br>dlopen(&quot;/usr/local/lib/python2.4/site-packages/sip.so&quot;, 2); 
<br>import sip # dynamically loaded from /usr/local/lib/python2.4/site- <br>packages/ <br>sip. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; so <br>dlopen(&quot;/usr/local/lib/python2.4/site-packages/<b style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">
 PyQt4</b>/QtCore.so&quot;, 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(&quot;/usr/local/lib/python2.4/lib-dynload/_codecs_cn.so&quot;, 2); <br>import _codecs_cn # dynamically loaded from /usr/local/lib/python2.4/ 
<br>lib-dynload/_codecs_cn.so <br>dlopen(&quot;/usr/local/lib/python2.4/lib-dynload/_multibytecodec.so&quot;, 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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; 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(&quot;/usr/local/lib/python2.4/site-packages/<b style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">
PyQt4</b>/QtGui.so&quot;, 2); <br>dlopen(&quot;/usr/local/lib/python2.4/site-packages/sip.so&quot;, 2); <br>import sip # dynamically loaded from /usr/local/lib/python2.4/site- <br>packages/sip.so <br>dlopen(&quot;/usr/local/lib/python2.4/site-packages/
<b style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">PyQt4</b> /QtCore.so&quot;, 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 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 &quot;show copying&quot; to see the conditions. 
<br>There is absolutely no warranty for GDB. &nbsp;Type &quot;show warranty&quot; for <br>details. <br>This GDB was configured as &quot;i386-marcel-freebsd&quot;...(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 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 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><span class="sg">-- <br></span></blockquote></div>
<div><br><br clear="all">Last night, I portupgraded gettext(it&nbsp;took&nbsp;a long time, though)</div>
<div>and now the problem has disappeared. I tested the&nbsp; example script tetrix.py, it&nbsp;ran smoothly.</div>
<div>&nbsp;</div>
<div>Before portupgrade gettext, I have got a runtime error something like &quot;shared library libintl.so.8&nbsp; not found&quot;(the system only has the libintl.so.6 that time) when ran PyQT4 script, and this was&nbsp;caused by the&nbsp;lower version of gettext, so I deleted it and reinstalled&nbsp; 
gettext0.16.1_1, then libintl.so.6 was replaces by libintl.so.8. But some other programs complained that they can&#39;t find libintl.so.6, so I&nbsp; linked libintl.so.8 to libintl.so.6.</div>
<div>At that point, I got the&nbsp;preceding problem(PyQT4 script always crashes).</div>
<div>So I think the problem may be caused by &#39;PyQt4&#39; mismatches &#39;gettext&#39;.</div>
<div>And there&nbsp;may be a simple solution :)</div>
<div>&nbsp;</div>
<div>regards,</div>
<div>jiang.haiyun</div>