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 <jmoh...@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@qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside >
_______________________________________________ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside