[PySide] QtNetwork.QSslSocket.supportsSsl()

Roman Lacko backup.rlacko at gmail.com
Wed Oct 8 21:16:17 CEST 2014


What about adding some environment variable check, PYSIDE_INIT_OPENSSL:

    # On Windows add the PySide\openssl folder (if it exists) to the
    # PATH so the SSL DLLs can be found when Qt tries to dynamically
    # load them.  Tell Qt to load them and then reset the PATH.
    if sys.platform == 'win32':
        initOpenSsl = os.environ['PYSIDE_INIT_OPENSSL']
        opensslDir = os.path.join(pysideDir, 'openssl')
        if initOpenSsl and os.path.exists(opensslDir):
            path = os.environ['PATH']
            try:
                os.environ['PATH'] = opensslDir + os.pathsep + path
                try:
                    from . import QtNetwork
                except ImportError:
                    pass
                else:
                    QtNetwork.QSslSocket.supportsSsl()
            finally:
                os.environ['PATH'] = path




2014-10-08 19:32 GMT+02:00 Joel B. Mohler <JMohler at gamry.com>:

> I just found an annoying bit in PySide.__init__ while examining
> application start-up time.  On my windows 7 32 bit machine, the call to
> QtNetwork.QSslSocket.supportsSsl() takes almost exactly 1 second.
> This seems inappropriate to me to force that call at that location since
> it takes that long.  Many applications would be conceivable that don't
> use QtNetwork at all or ssl but they all need to pay that cost.
>
> A related point is that I might want to use QSplashScreen but the most
> basic PySide import already imposes this 1-second delay.  That partly
> defeats the purpose of the splash screen.
>
> My question is two-fold then:
> 1)  Is there a plausible way to generally delay the action until it is
> more specifically needed?
> 2)  Is there a way I can forcibly remove that check for myself in a
> maintainable way?
>
> Well, there is sort of an answer to #2 by deleting the openssl directory
> since my app uses pure python for network access (if any) -- that's ugly
> to have to delete it though.  It's frustrating that I can't monkey patch
> this because I have to import PySide to monkeypatch and then the time is
> already wasted.
>
> Joel
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20141008/a9d88675/attachment.html>


More information about the PySide mailing list