Issue with QNetworkInformation

Phil Thompson phil at riverbankcomputing.com
Sun Sep 5 13:13:44 BST 2021


On 04/09/2021 18:50, Detlev Offenbach wrote:
> Hello,
> 
> I am facing an issue with QNetworkInformation. Trying to connect to
> the signal 'reachabilityChanged' fails with an error. Please see below
> for a console example. According to the error printed, no such signal
> exists but looking at the sip file shows, that it should. Please help
> me solve it.
> 
> ------------------------------------------------------------------------
> 
>>>> from PyQt6.QtCore import pyqtSlot
>>>> from PyQt6.QtNetwork import QNetworkInformation
>>>> @pyqtSlot(QNetworkInformation.Reachability)
> ... def reachabilityChanged(reach):
> ...  print(reach)
> ...
>>>> QNetworkInformation.load(QNetworkInformation.Feature.Reachability)
> True
>>>> QNetworkInformation.instance().reachability()
> <Reachability.Online: 4>
>>>> QNetworkInformation.instance().reachabilityChanged.connect(reachabilityChanged)
> StdErr: qt.core.qobject.connect: QObject::connect: No such signal
> QNetworkInformation::reachabilityChanged(QNetworkInformation::Reachability)
> neptun/12848/main: Traceback (innermost last):
>   File "<stdin>", line 1, in <module>
> TypeError: connect() failed between
> reachabilityChanged(QNetworkInformation::Reachability) and unislot()
>>>> 
> 
> ------------------------------------------------------------------------

Should be fixed in the next snapshot.

Thanks,
Phil


More information about the PyQt mailing list