471,071 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

System Error when running PyQt4's loadUi()

Hello,
I'm pretty new to Qt, Python and their combinations. I'm currently writing a QGIS plugin in python (I used QtCreator 2.1 (Qt Designer 4.7) to generate a .ui-file and am now trying to use it for a Quantum GIS plugin that's written in Python 2.5 (and running in the Quantum GIS Python 2.5 console)).
I am running into trouble when loading the ui-file dynamically when the program runs the loadUi() function. What throws me off is that the error occurs outside my script. Does that mean, I'm passing something wrong into it? Where does the error come in? Any hints on what could be wrong?
Expand|Select|Wrap|Line Numbers
  1. # Set up the user interface from Designer
  2. code_dir = os.path.dirname(os.path.abspath(__file__))
  3. self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self)
Traceback (most recent call last):
File "C:/Dokumente und Einstellungen/name.name/.qgis/python/plugins\myfile\myfile_plugin.py", line 57, in run
self.dialog = myfileUI(self.iface)
File "C:/Dokumente und Einstellungen/name.name/.qgis/python/plugins\myfile\myfile_gui.py", line 42, in __init__
self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\__init__.py", line 112, in loadUi
return DynamicUILoader().loadUi(uifile, baseinstance)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\Loader\loader.py", line 21, in loadUi
return self.parse(filename)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 768, in parse
actor(elem)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 616, in createUserInterface
self.traverseWidgetTree(elem)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 594, in traverseWidgetTree
handler(self, child)
File "C:\PROGRA~1\QUANTU~1\apps\Python25\lib\site-packages\PyQt4\uic\uiparser.py", line 233, in createWidget
topwidget.setCentralWidget(widget)
SystemError: error return without exception set
Mar 9 '11 #1

✓ answered by dwblas

I don't use QT much myself, but would guess that loadUi takes only one parameter, where you are passing two, a file name and "self".
self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self)

1 2919
dwblas
626 Expert 512MB
I don't use QT much myself, but would guess that loadUi takes only one parameter, where you are passing two, a file name and "self".
self.ui = loadUi(os.path.join(code_dir, "Ui_myfile.ui"), self)
Mar 10 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Simon Jefferies | last post: by
reply views Thread by Supra | last post: by
1 post views Thread by Matt | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.