Hi all,
I'm getting this error when I use loadUi():
Traceback (most recent call last):
File ./testui, line 26, in module
t = Test()
File ./testui, line 13, in __init__
self.ui = uic.loadUi(test-broken.ui, self)
File /usr/lib/python3/dist-packages/PyQt5/uic/__init__.py, line 224, in
loadUi
return DynamicUILoader(package).loadUi(uifile, baseinstance,
resource_suffix)
File /usr/lib/python3/dist-packages/PyQt5/uic/Loader/loader.py, line 72, in
loadUi
return self.parse(filename, resource_suffix, basedir)
File /usr/lib/python3/dist-packages/PyQt5/uic/uiparser.py, line 931, in
parse
actor(elem)
File /usr/lib/python3/dist-packages/PyQt5/uic/uiparser.py, line 856, in
createConnections
bound_signal.connect(slot)
SystemError: error return without exception set
I've narrowed this down to occuring when I've added custom slots in
the ui designer. However, it doesn't always occur, and I can't see
any obvious reasons for failure.
I've attached the most minimal testcase I can make. The testui
program just loads one of the two attached .ui files. One works,
one fails. The only difference is one line which changes which
slot gets used. However, both slots are absolutely identical,
and I can't see any reason for the failure unless either of the
names is somehow special.
The code from which the testcase was derived is here:
http://anonscm.debian.org/gitweb/?p=users/rleigh/ogcalc.git;a=tree;f=qt/python;h=0d60c1c99d0438096badb186a030f166202e1a98;hb=341b96685f3abe92e78fd7768fc5c5893ce5b5ee
(ogcalc-ui, ogcalc.ui, SpinBoxEntry.py). In this example both
the reset and calculate callbacks cause the failure; removing the
signal connection for both makes the UI load. But if I remove
widgets from the UI to get to the minimal example above, it
eventually will start working by the time I'm down to the
minimal example above.
Being relatively new to both Qt and PyQt, I'm unsure if this isn't
me doing something wrong, but I can't see anything obviously bad
here so I'm wondering if I'm tripping over some odd edge case in
how the signal autoconnection works. Either way, I'd be very
keen to understand what's going wrong here.
I'm using Python 3.3/Qt 5.1/PyQt 5.0 on Debian (unstable, amd64).
Thanks all,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`-GPG Public Key: 0x25BFB848 Please GPG sign your mail.
#!/usr/bin/python3
from PyQt5 import uic
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtGui import (QFont, QIcon)
from PyQt5.QtWidgets import (QApplication, QMainWindow)
class Test(QMainWindow):
def __init__(self):
super(Test, self).__init__()
#self.ui = uic.loadUi(test-ok.ui, self)
self.ui = uic.loadUi(test-broken.ui, self)
@pyqtSlot()
def calculate(self):
print(Calc)
@pyqtSlot()
def reset(self):
print(Reset)
if __name__ == __main__:
import sys
app = QApplication(sys.argv)
t = Test()
t.show()
sys.exit(app.exec())
?xml version=1.0 encoding=UTF-8?
ui version=4.0
classogcalc/class
widget class=QMainWindow name=ogcalc
property name=geometry
rect
x0/x
y0/y
width407/width
height123/height
/rect
/property
property name=sizePolicy
sizepolicy hsizetype=Preferred vsizetype=Preferred
horstretch0/horstretch
verstretch0/verstretch
/sizepolicy
/property
property name=maximumSize
size
width16777215/width
height16777215/height
/size
/property
property name=windowTitle
stringOG amp; ABV calculator/string
/property
property name=windowIcon
iconset
normaloffogcalc.svg/normaloffogcalc.svg/iconset
/property
widget class=QWidget name=toplevel_layout
property name=sizePolicy
sizepolicy hsizetype=Minimum vsizetype=Minimum
horstretch0/horstretch
verstretch0/verstretch
/sizepolicy
/property
layout class=QVBoxLayout name=vertical_layout
item
widget class=QPushButton name=reset
property name=text
stringReset/string
/property
/widget
/item
/layout
/widget
/widget
layoutdefault spacing=6 margin=11/
resources/
connections
connection
senderreset/sender
signalclicked()/signal
receiverogcalc/receiver
slotcalculate()/slot
hints
hint type=sourcelabel
x203/x
y102/y
/hint
hint type=destinationlabel
x203/x
y61/y
/hint
/hints
/connection
/connections
slots
slotcalculate()/slot
slotreset()/slot
/slots
/ui
?xml version=1.0 encoding=UTF-8?
ui version=4.0
classogcalc/class
widget class=QMainWindow name=ogcalc
property name=geometry
rect
x0/x
y0/y
width407/width
height123/height
/rect
/property
property name=sizePolicy
sizepolicy hsizetype=Preferred vsizetype=Preferred
horstretch0/horstretch
verstretch0/verstretch
/sizepolicy
/property
property