[PyQt] QString rfind exception in uic.loadUi
Phil Thompson
phil at riverbankcomputing.com
Tue Sep 14 10:07:36 BST 2010
On Tue, 14 Sep 2010 09:23:52 +0300, Gökçen Eraslan <gokcen at pardus.org.tr>
wrote:
> Hello,
>
> When I run this code:
>
> from PyQt4 import uic
> from PyQt4.QtCore import QString
> uic.loadUi(QString("notexists.ui"))
>
> in sip 4.10.2 and PyQt 4.7.3, I'm getting
>
> -----------------
> Traceback (most recent call last):
> ...
> ...
> IOError: [Errno 2] No such file or directory:
> PyQt4.QtCore.QString(u'notexists.ui')
> -----------------
>
> as usual but in sip 4.11.1 and PyQt 4.7.6, I'm getting:
>
> -----------------
> Traceback (most recent call last):
> File "uicexample.py", line 7, in <module>
> uic.loadUi(QString("notexists.ui"))
> File "/usr/lib/python2.7/site-packages/PyQt4/uic/__init__.py", line
182,
> in
> loadUi
> return DynamicUILoader().loadUi(uifile, baseinstance)
> File "/usr/lib/python2.7/site-packages/PyQt4/uic/Loader/loader.py",
line
> 24,
> in loadUi
> return self.parse(filename, os.path.dirname(filename))
> File "/usr/lib/python2.7/posixpath.py", line 119, in dirname
> i = p.rfind('/') + 1
> AttributeError: 'QString' object has no attribute 'rfind'
> -----------------
>
> Any ideas about that?
Strictly speaking loadUi() isn't defined as accepting a QString filename,
but it is a change of behaviour.
Should be fixed in tonight's snapshot.
Phil
More information about the PyQt
mailing list