[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    heads-up: QtWebEngine 6.5 and "Argument list is empty" / pytest-qt aborts
From:       Florian Bruhin <me () the-compiler ! org>
Date:       2023-03-17 18:51:43
Message-ID: tnucw7ggzm2uu2ipbezx3a36ozojev7vwtb3hrblaeuzz5lqgb () jqi7gvpvws53
[Download RAW message or body]


Hey,

FYI, for anyone who has issues with abort()s on Qt 6.5 with QtWebEngine,
it looks like Qt now requires passing sys.argv[0] into it correctly.

The somewhat common pattern of doing:

    from PyQt6.QtWidgets import QApplication
    from PyQt6.QtWebEngineCore import QWebEngineProfile
    app = QApplication([])
    QWebEngineProfile()

will now lead to:

    Argument list is empty, the program name is not passed to
    QCoreApplication. base::CommandLine cannot be properly initialized.

And you should instead use one of:

    QApplication(sys.argv)
    QApplication([sys.argv[0]])
    QApplication(sys.argv[:1])

(the first option passes all arguments on to Qt, which might or might
not be desirable).

This currently also causes issues with pytest-qt, which also passes an
empty list by default:

https://github.com/pytest-dev/pytest-qt/issues/483

This can be worked around by doing:

    @pytest.fixture(scope="session")
    def qapp_args():
        return [sys.argv[0]]

in something like a conftest.py.

I'm busy giving a Python company training until the end of the month, so
I might not get around to fixing this and getting out a new release.
Maybe nicoddemus (the primary maintainer of the plugin) will, but if
not, expect your tests to break if you're using QtWebEngine 6.5...

Florian

-- 
            me@the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic