[PyQt] QUrl Failed!

Baz Walter bazwal at ftml.net
Tue Mar 15 00:16:19 GMT 2016


On 14/03/16 22:41, Miguel  Alejandro Fernandez wrote:
> python 3.4 PyQt5.5.1
>
> working in a proyect see next error:
>
> path = 'file:///F:/WD SmartWare.swstor/QT/proyectos/ninja/ninja-ide-2.3/ninja_ide/tools/runner.py'
>
> url = QUrl(path)
>
> print(url.path())# first char "/" not removed
>
> "/F:/WD SmartWare.swstor/QT/proyectos/ninja/ninja-ide-2.3/ninja_ide/tools/runner.py"
>
> print(url.toLocalFile())
> "F:/WD SmartWare.swstor/QT/proyectos/ninja/ninja-ide-2.3/ninja_ide/tools/runner.py"

I don't see any errors.

The first is interpreted as a url with an empty network location, so the 
path starts immediately after the second forward slash.

Compare with Python:

 >>> from urllib.parse import urlparse
 >>> urlparse(path).path
'/F:/WD 
SmartWare.swstor/QT/proyectos/ninja/ninja-ide-2.3/ninja_ide/tools/runner.py'



More information about the PyQt mailing list