[Qgis-developer] Qstring has no attribute toStdString

Denis Rouzaud denis.rouzaud at gmail.com
Wed Apr 11 04:56:07 EDT 2012


Hi Jurgen,

I needed this for subprocess.call/Popen since it does not accept QStrings.
I always read at doc.qt.nokia, that's where I found it.
http://qt-project.org/doc/qt-4.8/qstring.html#toStdString
" This operator is only available if Qt is configured with STL 
compatibility enabled."

I thought that everything in qt was in pyqt, but this is apparently not 
true.

I finally end up using str("%s" % myString), which works.

Thanks a lot for your answer.

Denis



On 04/11/2012 10:39 AM, Jürgen E. Fischer wrote:
> Hi Denis,
>
> On Wed, 11. Apr 2012 at 09:49:41 +0200, Denis Rouzaud wrote:
>>     I have an error when I try to use toStdString method on a QString:
>>     AttributeError: 'QString' object has no attribute 'toStdString'
>>     Someone has a clue on this???
> Apparently PyQt doesn't have that method[1].  What do you need that for in
> Python?
>
>
> Jürgen
>
>
> [1] http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120411/5df146e5/attachment.html


More information about the Qgis-developer mailing list