[PyQt] KConfigSkeleton and pyqt4 API version 2

Hans-Peter Jansen hpj at urpla.net
Fri Sep 17 08:56:21 BST 2010


Hi Wolfgang,

first of all, this is the wrong list for PyKDE issues. Try to resend this 
to the kde-bindings ML:

https://mail.kde.org/mailman/listinfo/kde-bindings

On Friday 17 September 2010, 00:11:18 Wolfgang Rohdewald wrote:
> Hi,
>
> this code prints random output. How should I fix this?
>
> import sip
> sip.setapi('QString', 2)
>
> from PyKDE4.kdeui import KConfigSkeleton

You're missing to  create a {Q,K}Application instance here.
There's also a problem with KApplication:

>>> from PyKDE4.kdeui import KApplication
>>> app = KApplication()


FAILURE (KCmdLineArgs):
Application has not called KCmdLineArgs::init(...).

According to:
http://api.kde.org/4.5-api/kdelibs-apidocs/kdeui/html/classKApplication.html

it should do without any parameter.

> a = KConfigSkeleton()
> name = 'tilesetName'
> value = 'I am a value'
> s = a.addItemString(name, value)
> print s.value()
>
> ====== output: ======
> value is: 䱀Ɨ!䱠Ɨ彐Ɨ美繈
> *** glibc detected *** python: corrupted double-linked list:
> 0x0000000001975f50 ***

Same here:

(gdb) run
Starting program: /usr/bin/python 
[Thread debugging using libthread_db enabled]
Python 2.6 (r26:66714, Mar 30 2010, 00:30:21) 
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import QApplication
>>> from PyKDE4.kdeui import KConfigSkeleton
>>> app = QApplication([])
>>> a = KConfigSkeleton()
>>> name = 'tilesetName'
>>> value = 'I am a value'
>>> s = a.addItemString(name, value)
>>> print s.value()

Program received signal SIGSEGV, Segmentation fault.
memcpy () at ../sysdeps/i386/i686/memcpy.S:100
100     2:      rep
Current language:  auto; currently asm
(gdb) bt
#0  memcpy () at ../sysdeps/i386/i686/memcpy.S:100
#1  0xb67ebe41 in QString::realloc (this=0x834ba38, alloc=137673264) at /usr/include/bits/string3.h:52
#2  0xb67ebf86 in QString::realloc (this=0x834ba38) at tools/qstring.cpp:1250
#3  0xb67ebfbe in QString::utf16 (this=0x834ba38) at tools/qstring.cpp:4690
#4  0xb67ec084 in QString::toUcs4 (this=0x834ba38) at tools/qstring.cpp:3574
#5  0xb619aefc in ?? () from /usr/lib/python2.6/site-packages/PyQt4/QtCore.so
#6  0xb60c3f19 in ?? () from /usr/lib/python2.6/site-packages/PyQt4/QtCore.so
#7  0xb7ea4d1f in _PyObject_Str (v=0x82738fc) at Objects/object.c:415
#8  0xb7ea4de5 in PyObject_Str (v=0x82738fc) at Objects/object.c:436
#9  0xb7ea2ea5 in internal_print (op=0x82738fc, fp=0xb7dec4c0, flags=1, nesting=0) at Objects/object.c:297
#10 0xb7e8514d in PyFile_WriteObject (v=0x82738fc, f=0xb7c64070, flags=<value optimized out>)
    at Objects/fileobject.c:116
#11 0xb7ef59bc in PyEval_EvalFrameEx (f=0x834d3bc, throwflag=0) at Python/ceval.c:1598
#12 0xb7ef9daf in PyEval_EvalCodeEx (co=0xb7c210f8, globals=0xb7c7702c, locals=0xb7c7702c, args=0x0, argcount=0, 
    kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2942
#13 0xb7ef1ca3 in PyEval_EvalCode (co=0xb7c210f8, globals=0xb7c7702c, locals=0xb7c7702c) at Python/ceval.c:515
#14 0xb7f13b0c in run_mod (mod=<value optimized out>, filename=<value optimized out>, globals=0xb7c7702c, 
    locals=0xb7c7702c, flags=0xbfffebc8, arena=0x804b460) at Python/pythonrun.c:1330
#15 0xb7f165fc in PyRun_InteractiveOneFlags (fp=0xb7dec420, filename=0xb7f5118f "<stdin>", flags=0xbfffebc8)
    at Python/pythonrun.c:836
#16 0xb7f167d8 in PyRun_InteractiveLoopFlags (fp=0xb7dec420, filename=0xb7f5118f "<stdin>", flags=0xbfffebc8)
    at Python/pythonrun.c:756
#17 0xb7f1486f in PyRun_AnyFileExFlags (fp=0xb7dec420, filename=0xb7f5118f "<stdin>", closeit=0, flags=0xbfffebc8)
    at Python/pythonrun.c:725
#18 0xb7f20e42 in Py_Main (argc=0, argv=0xbfffec94) at Modules/main.c:597
#19 0x08048692 in main (argc=Cannot access memory at address 0x419d3a4
) at Modules/python.c:23


Python version: 2.6
sip version: 4.10.5
Qt4 version: 4.6.3
PyQt4 version: 4.7.4
PyKDE4 version: 4.4.4

>
> ii  python-qt4
> 4.7.3-1ubuntu2~lucid1~ppa3                      Python bindings
> for Qt4
>
> ii  python-kde4
> 4:4.5.1-0ubuntu1~lucid1~ppa1                    Python bindings
> for the KDE 4 libraries


Pete


More information about the PyQt mailing list