Commit d7e05bd6 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Fix configparser

parent 4fd99e25
...@@ -5,10 +5,10 @@ import logging ...@@ -5,10 +5,10 @@ import logging
from astropy.coordinates import SkyCoord, AltAz from astropy.coordinates import SkyCoord, AltAz
from astropy import units as u from astropy import units as u
from configparser import ConfigParser from configparser import ConfigParser
import os.path
config = ConfigParser() config = ConfigParser()
config.read('telescope.ini') config.readfp(open(os.path.join(os.path.dirname(__file__), 'telescope.ini')))
print(config.keys())
class telescope(): class telescope():
def __init__(self, setmode=None, consoleHost=None): def __init__(self, setmode=None, consoleHost=None):
...@@ -21,14 +21,16 @@ class telescope(): ...@@ -21,14 +21,16 @@ class telescope():
self.setmode = setmode self.setmode = setmode
self.readsocketj2000 = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.readsocketj2000 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.readsocketj2000.connect((config['Console']['HostName'], self.readsocketj2000.connect((config.get('Console','HostName'),
config['Console']['Port_Read_J2000'])) config.getint('Console','Port_Read_J2000')))
self.outsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.outsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.setmode == 'J2000': if self.setmode == 'J2000':
self.outsocket.connect((host, setport_j2000)) self.outsocket.connect((config.get('Console','HostName'),
config.getint('Console','Port_Write_J2000')))
elif self.setmode == 'AZEL': elif self.setmode == 'AZEL':
self.outsocket.connect((host, setport_azel)) self.outsocket.connect((config.get('Console','HostName'),
config.getint('Console','Port_Write_AzEl')))
def getRaDec(self): def getRaDec(self):
''' '''
......
Supports Markdown
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