<br><br><div class="gmail_quote">2009/1/26 David Boddie <span dir="ltr"><<a href="mailto:david@boddie.org.uk">david@boddie.org.uk</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sun Jan 25 22:17:46 GMT 2009, piotr malinski wrote:<br>
<br>
> Here is an example script:<br>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
> from PyQt4.QtCore import *<br>
> from PyQt4.QtGui import *<br>
><br>
> d = QDesktopServices()<br>
><br>
> x = '/home/piotr/test2/lol bar/photo_4900_8ea80c_huge.jpg'<br>
> print QUrl(x).isValid()<br>
> d.openUrl(QUrl(x))<br>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
> The problem is it won't work if there is a space in the path - "lol<br>
> bar", for spaceless paths it works (also for example on windows it<br>
> needs paths with slashes not backslashes...). How can I make the path<br>
> valid for QDesktopServices? (the QUrl itself is valid)<br>
<br>
</div>Perhaps try encoding the URL first:<br>
<br>
<a href="http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qurl.html#toEncoded" target="_blank">http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qurl.html#toEncoded</a><br>
<br>
This may be related to a bug that was apparently fixed in Qt 4.4.0:<br>
<br>
<a href="http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=194046" target="_blank">http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=194046</a><br>
<br>
You don't say which version of Qt you are using. If it's later than Qt 4.4.0,<br>
it would be good if you could report this as a bug using the Task Tracker.<br>
<br>
David<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>
</blockquote></div><br><br>PyQt 4.4.4-r1, Qt 4.4.2, and using:<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>from PyQt4.QtCore import *<br>from PyQt4.QtGui import *<br><br>d = QDesktopServices()<br><br>x = '/home/piotr/test2/lol bar/photo_4900_8ea80c_huge.jpg'<br>
x = unicode(QUrl(x).toEncoded()<br>print x<br>print QUrl(x).isValid()<br>d.openUrl(QUrl(x))<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Doesn't help. So is it a Qt bug?<br>