Skip to content
Browse files

Fix issue with python2.5 missing ssl (no ssl support if package is no…

…t installed)
  • Loading branch information...
1 parent 7110b44 commit f96352593693fda1f76a7186552eac5825e21772 @reingart reingart committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 pg8000/
9 pg8000/
@@ -30,7 +30,10 @@
__author__ = "Mathieu Fenniak"
import socket
-import ssl as sslmodule
+ import ssl as sslmodule
+except ImportError:
+ sslmodule = None
import select
import threading
import struct
@@ -945,8 +948,10 @@ def __init__(self, unix_sock=None, host=None, port=5432, socket_timeout=60, ssl=
resp = self._sock.recv(1)
- if resp == 'S':
+ if resp == 'S' and sslmodule is not None:
self._sock = sslmodule.wrap_socket(self._sock)
+ elif sslmodule is None:
+ raise InterfaceError("SSL required but ssl module not available in this python installation")
raise InterfaceError("server refuses SSL")

0 comments on commit f963525

Please sign in to comment.
Something went wrong with that request. Please try again.