[PyQt] AttributeError: 'QString' object has no attribute 'endswith'

Hans-Peter Jansen hpj at urpla.net
Wed Oct 26 16:17:38 BST 2016


On Dienstag, 25. Oktober 2016 12:37:00 Yosbanis Vicente Gonzalez wrote:
>         dir = self.ledit_send_dir.text()

You're getting a QString out of your UI. Try:

         dir = unicode(self.ledit_send_dir.text())

_One_ way to avoid these games is using Python 3, where all strings are 
unicode strings, and consequently, PyQt has eliminated QString altogether..

Cheers,
Pete



More information about the PyQt mailing list