connectors/PYRO/PSK_Adapter.py
changeset 2588 25f19b76c7b6
parent 2544 640d639d9bd8
child 2597 7e20fe7facd6
--- a/connectors/PYRO/PSK_Adapter.py	Tue Apr 09 14:08:44 2019 +0200
+++ b/connectors/PYRO/PSK_Adapter.py	Wed Apr 10 21:36:12 2019 +0200
@@ -34,13 +34,17 @@
 import socket
 import re
 import ssl
-import sslpsk
 import Pyro
 from Pyro.core import PyroURI
 from Pyro.protocol import _connect_socket, TCPConnection, PYROAdapter
 from Pyro.errors import ConnectionDeniedError, ProtocolError
 from Pyro.util import Log
 
+try:
+    import sslpsk
+except ImportError as e:
+    print(str(e))
+    sslpsk = None
 
 class PYROPSKAdapter(PYROAdapter):
     """
@@ -126,5 +130,8 @@
     This function should be called after
     reimport of Pyro module to enable PYROS:// again.
     """
-    Pyro.protocol.getProtocolAdapter = getProtocolAdapter
-    Pyro.core.processStringURI = processStringURI
+    if sslpsk is not None:
+        Pyro.protocol.getProtocolAdapter = getProtocolAdapter
+        Pyro.core.processStringURI = processStringURI
+    else:
+        raise Exception("sslpsk python module unavailable")