[PyQt] QUrl Fail!!!

Florian Bruhin me at the-compiler.org
Tue Aug 23 05:18:46 BST 2016


* Miguel Alejandro Fernández <alejandrogroso at hotmail.com> [2016-08-23 00:07:56 +0000]:
> I recently installed PyQt5.7 in python3.5.2 in Windows 7.
> I tried to run some simple programs that already had done and worked in
> previous versions,
> but now qurl not charge local directory files, but tries to always look in
> "C:/Users/Fernandez Miguel A/".
> (the python and qml file stay in "E:\not SYS\Errata
> PyQt\quick\extras\flat\")

How would Python/PyQt know where the file is stored?

QUrl.fromLocalDirectory with a relative path (like you did here) will
look in the directory you run your script in.

>     # The next line also fails
> 
>     #engine = QQmlApplicationEngine(QUrl("MAIN.qml"))
>     # With the next line run normally
>     #engine = QQmlApplicationEngine(QUrl.fromUserInput("MAIN.qml",
> sys.path[0]))

That'd just try to create an URL like http://main.qml

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160823/cb3a561c/attachment.sig>


More information about the PyQt mailing list