[PyQt] Different Behavior between Python 2.6 and Python 3.1.1

Richard Parker r.richardparker at comcast.net
Tue Jan 12 22:44:53 GMT 2010

I have the following statement in an application that runs fine with Python 2.6 (and PyQt): 

text = self.ui.txtText.text().left(5).toUpper() 

In Python 3.1.1 (with PyQt), I get the following error for the first statement: 

" text = self.ui.txtText.text().left(5).toUpper() 
AttributeError: 'str' object has no attribute 'left' " 

The "ui.txtText.text" object is a QLineEdit object, whose documentation indicates that its "text()" function returns a QString object, whose documentatation states that the "left( self , n)" and "toUpper() functions are supported. What has changed between Python 2.6 and Python 3.1 that would account for this error? 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100112/88d30e5b/attachment.html>

More information about the PyQt mailing list