[PySide] QtNetwork.QSslSocket.supportsSsl()

Joel B. Mohler JMohler at Gamry.com
Wed Oct 8 22:56:34 CEST 2014

On 10/8/2014 3:16 PM, Roman Lacko wrote:
> What about adding some environment variable check, PYSIDE_INIT_OPENSSL:

This went through my mind too so I'm glad to hear a vote in this 
direction from somebody else.  I also agree with the semantics of your 
boolean -- you should have to explicitly set this to have this code 
run.  My rationale for this is that I tend to view my work as Python 
first and would use Python libraries for my networking rather than 
PySide if possible.

If I don't hear any ideas to the contrary, I'll probably put this in a 
patch in the next day or so.

>     # 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

More information about the PySide mailing list