With PyQt 4.7.2 (Qt 4.6.2, sip 4.10), it is not possible to load the attached ui file. The problem happens whenever a value is inserted in a QTableWidget with designer. It used to work with PyQt 4.3.3.<br><br>The following code (used in IPython):<br>

<br><div style="margin-left: 40px;"><font size="1"><span style="font-family: courier new,monospace;">from PyQt4.uic import loadUi</span></font><br style="font-family: courier new,monospace;"><font size="1"><span style="font-family: courier new,monospace;">from PyQt4.QtGui import QWidget</span></font><br style="font-family: courier new,monospace;">

<font size="1"><span style="font-family: courier new,monospace;">w= QWidget()</span></font><br style="font-family: courier new,monospace;"><font size="1"><span style="font-family: courier new,monospace;">loadUi( &#39;/tmp/test.ui&#39;, w )</span></font><br style="font-family: courier new,monospace;">

</div><br>raises the following error:<br><br><div style="margin-left: 40px;"><font style="font-family: courier new,monospace;" size="1">---------------------------------------------------------------------------</font><br>

<font style="font-family: courier new,monospace;" size="1">AttributeError                            Traceback (most recent call last)</font><br><br><font style="font-family: courier new,monospace;" size="1">/home/yc176684/&lt;ipython console&gt; in &lt;module&gt;()</font><br>

<br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/__init__.py in loadUi(uifile, baseinstance)</font><br><font style="font-family: courier new,monospace;" size="1">    175     from PyQt4.uic.Loader.loader import DynamicUILoader</font><br>

<font style="font-family: courier new,monospace;" size="1">    176</font><br><font style="font-family: courier new,monospace;" size="1">--&gt; 177     return DynamicUILoader().loadUi(uifile, baseinstance)</font><br><font style="font-family: courier new,monospace;" size="1">    178</font><br>

<font style="font-family: courier new,monospace;" size="1">    179</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/Loader/loader.py in loadUi(self, filename, toplevelInst)</font><br>

<font style="font-family: courier new,monospace;" size="1">     17             return self.factory.createQObject(classname, widgetname, ())</font><br><font style="font-family: courier new,monospace;" size="1">     18</font><br>

<font style="font-family: courier new,monospace;" size="1">     19     def loadUi(self, filename, toplevelInst = None):</font><br><font style="font-family: courier new,monospace;" size="1">     20         self.toplevelInst = toplevelInst</font><br>

<font style="font-family: courier new,monospace;" size="1">---&gt; 21         return self.parse(filename)</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in parse(self, filename)</font><br>

<font style="font-family: courier new,monospace;" size="1">    811             elem = document.find(tagname)</font><br><font style="font-family: courier new,monospace;" size="1">    812             if elem is not None:</font><br>

<font style="font-family: courier new,monospace;" size="1">--&gt; 813                 actor(elem)</font><br><font style="font-family: courier new,monospace;" size="1">    814         self.finalize()</font><br><font style="font-family: courier new,monospace;" size="1">    815         w = self.toplevelWidget</font><br>

<br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in createUserInterface(self, elem)</font><br><font style="font-family: courier new,monospace;" size="1">    659         self.wprops.setProperties(self.toplevelWidget, elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    660         self.stack.push(self.toplevelWidget)</font><br><font style="font-family: courier new,monospace;" size="1">--&gt; 661         self.traverseWidgetTree(elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    662         self.stack.popWidget()</font><br><font style="font-family: courier new,monospace;" size="1">    663         self.addActions()</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in traverseWidgetTree(self, elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    637                 continue</font><br><font style="font-family: courier new,monospace;" size="1">    638</font><br><font style="font-family: courier new,monospace;" size="1">--&gt; 639             handler(self, child)</font><br>

<font style="font-family: courier new,monospace;" size="1">    640</font><br><font style="font-family: courier new,monospace;" size="1">    641     def createUserInterface(self, elem):</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in createWidget(self, elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    167             self.stack.topwidget.setRowCount(len(elem.findall(&quot;row&quot;)))</font><br><font style="font-family: courier new,monospace;" size="1">    168</font><br>

<font style="font-family: courier new,monospace;" size="1">--&gt; 169         self.traverseWidgetTree(elem)</font><br><font style="font-family: courier new,monospace;" size="1">    170         widget = self.stack.popWidget()</font><br>

<font style="font-family: courier new,monospace;" size="1">    171</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in traverseWidgetTree(self, elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    637                 continue</font><br><font style="font-family: courier new,monospace;" size="1">    638</font><br><font style="font-family: courier new,monospace;" size="1">--&gt; 639             handler(self, child)</font><br>

<font style="font-family: courier new,monospace;" size="1">    640</font><br><font style="font-family: courier new,monospace;" size="1">    641     def createUserInterface(self, elem):</font><br><br><font style="font-family: courier new,monospace;" size="1">/i2bm/research/Mandriva-2008.0-i686/python/lib/python2.5/site-packages/PyQt4/uic/uiparser.py in handleItem(self, elem)</font><br>

<font style="font-family: courier new,monospace;" size="1">    544</font><br><font style="font-family: courier new,monospace;" size="1">    545                 if text:</font><br><font style="font-family: courier new,monospace;" size="1">--&gt; 546                     w.item(row, col).setText(text)</font><br>

<font style="font-family: courier new,monospace;" size="1">    547</font><br><font style="font-family: courier new,monospace;" size="1">    548                 if icon:</font><br><br><font style="font-family: courier new,monospace;" size="1">AttributeError: &#39;NoneType&#39; object has no attribute &#39;setText&#39;</font><br>

</div><br>