Commit 5b77f664 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Raise error when could not connect

parent 4ab96dbf
......@@ -46,17 +46,26 @@ class telescope():
self._outsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.setmode == 'J2000':
self._outsocket.connect((consoleHost,
try:
self._outsocket.connect((consoleHost,
config.getint('Console','Port_Write_J2000')))
except socket.gaierror as e:
raise IOError("Could not connect to DT J2000 port: " + str(e))
elif self.setmode == 'AZEL':
self._outsocket.connect((consoleHost,
try:
self._outsocket.connect((consoleHost,
config.getint('Console','Port_Write_AzEl')))
except socket.gaierror as e:
raise IOError("Could not connect to DT AZEL port: " + str(e))
# Initialize offset socket for all modes where output is desired
if self.setmode is not None:
self._offsetsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._offsetsocket.connect((consoleHost,
try:
self._offsetsocket.connect((consoleHost,
config.getint('Console','Port_Write_Offset')))
except socket.gaierror as e:
raise IOError("Could not connect to DT Offset port: " + str(e))
self._event_j2000 = threading.Event()
thread_read_j2000 = threading.Thread(target=self._readj2000, args=(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment