Prevent printing to console
This commit is contained in:
@@ -22,23 +22,23 @@ def readConfig():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['PLC_IP_ADDRESS'] = str(configObj['ip_address'])
|
configProperties['PLC_IP_ADDRESS'] = str(configObj['ip_address'])
|
||||||
print("FYI, using PLC IP Address from the database {0}".format(configProperties['PLC_IP_ADDRESS']))
|
# print("FYI, using PLC IP Address from the database {0}".format(configProperties['PLC_IP_ADDRESS']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no PLC IP Address stored in the database, defaulting to 192.168.1.10")
|
print("FYI, there is no PLC IP Address stored in the database, defaulting to 192.168.1.10")
|
||||||
configProperties['PLC_IP_ADDRESS'] = "192.168.1.10"
|
# configProperties['PLC_IP_ADDRESS'] = "192.168.1.10"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['plc_type'] = str(configObj['plc_type'])
|
configProperties['plc_type'] = str(configObj['plc_type'])
|
||||||
print("FYI, using PLC Type from the database {0}".format(configProperties['plc_type']))
|
# print("FYI, using PLC Type from the database {0}".format(configProperties['plc_type']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no PLC Type stored in the database, defaulting to CLX")
|
# print("FYI, there is no PLC Type stored in the database, defaulting to CLX")
|
||||||
configProperties['plc_type'] = "CLX"
|
configProperties['plc_type'] = "CLX"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['scan_rate'] = int(configObj['scan_rate'])
|
configProperties['scan_rate'] = int(configObj['scan_rate'])
|
||||||
print("FYI, using Scan Rate from the database {0}".format(configProperties['scan_rate']))
|
# print("FYI, using Scan Rate from the database {0}".format(configProperties['scan_rate']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no Scan Rate stored in the database, defaulting to 10 seconds")
|
# print("FYI, there is no Scan Rate stored in the database, defaulting to 10 seconds")
|
||||||
configProperties['scan_rate'] = 10
|
configProperties['scan_rate'] = 10
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -49,9 +49,9 @@ def readConfig():
|
|||||||
configProperties['save_all'] = False
|
configProperties['save_all'] = False
|
||||||
else:
|
else:
|
||||||
configProperties['save_all'] = "test"
|
configProperties['save_all'] = "test"
|
||||||
print("FYI, value for save_all is {0}".format(configProperties['save_all']))
|
# print("FYI, value for save_all is {0}".format(configProperties['save_all']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no save_all value stored in the database, using 'test'")
|
# print("FYI, there is no save_all value stored in the database, using 'test'")
|
||||||
configProperties['save_all'] = 'test'
|
configProperties['save_all'] = 'test'
|
||||||
|
|
||||||
return configProperties
|
return configProperties
|
||||||
|
|||||||
@@ -17,23 +17,23 @@ def readConfig():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['PLC_IP_ADDRESS'] = str(configObj['ip_address'])
|
configProperties['PLC_IP_ADDRESS'] = str(configObj['ip_address'])
|
||||||
print("FYI, using PLC IP Address from the database {0}".format(configProperties['PLC_IP_ADDRESS']))
|
# print("FYI, using PLC IP Address from the database {0}".format(configProperties['PLC_IP_ADDRESS']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no PLC IP Address stored in the database, defaulting to 192.168.1.10")
|
# print("FYI, there is no PLC IP Address stored in the database, defaulting to 192.168.1.10")
|
||||||
configProperties['PLC_IP_ADDRESS'] = "192.168.1.10"
|
configProperties['PLC_IP_ADDRESS'] = "192.168.1.10"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['plc_type'] = str(configObj['plc_type'])
|
configProperties['plc_type'] = str(configObj['plc_type'])
|
||||||
print("FYI, using PLC Type from the database {0}".format(configProperties['plc_type']))
|
# print("FYI, using PLC Type from the database {0}".format(configProperties['plc_type']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no PLC Type stored in the database, defaulting to CLX")
|
# print("FYI, there is no PLC Type stored in the database, defaulting to CLX")
|
||||||
configProperties['plc_type'] = "CLX"
|
configProperties['plc_type'] = "CLX"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
configProperties['scan_rate'] = int(configObj['scan_rate'])
|
configProperties['scan_rate'] = int(configObj['scan_rate'])
|
||||||
print("FYI, using Scan Rate from the database {0}".format(configProperties['scan_rate']))
|
# print("FYI, using Scan Rate from the database {0}".format(configProperties['scan_rate']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no Scan Rate stored in the database, defaulting to 10 seconds")
|
# print("FYI, there is no Scan Rate stored in the database, defaulting to 10 seconds")
|
||||||
configProperties['scan_rate'] = 10
|
configProperties['scan_rate'] = 10
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -44,9 +44,9 @@ def readConfig():
|
|||||||
configProperties['save_all'] = False
|
configProperties['save_all'] = False
|
||||||
else:
|
else:
|
||||||
configProperties['save_all'] = "test"
|
configProperties['save_all'] = "test"
|
||||||
print("FYI, value for save_all is {0}".format(configProperties['save_all']))
|
# print("FYI, value for save_all is {0}".format(configProperties['save_all']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print("FYI, there is no save_all value stored in the database, using 'test'")
|
# print("FYI, there is no save_all value stored in the database, using 'test'")
|
||||||
configProperties['save_all'] = 'test'
|
configProperties['save_all'] = 'test'
|
||||||
|
|
||||||
return configProperties
|
return configProperties
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from pycomm.ab_comm.clx import Driver as ClxDriver
|
|||||||
import traceback
|
import traceback
|
||||||
import math
|
import math
|
||||||
from readConfig import readConfig
|
from readConfig import readConfig
|
||||||
|
import sys, os
|
||||||
|
|
||||||
today_tags = [
|
today_tags = [
|
||||||
{'name':"Average_SPM",'tag':"TODAY_Average_SPM"},
|
{'name':"Average_SPM",'tag':"TODAY_Average_SPM"},
|
||||||
@@ -52,11 +53,14 @@ def main():
|
|||||||
global today_tags, retry_attempts, retries_allowed
|
global today_tags, retry_attempts, retries_allowed
|
||||||
try:
|
try:
|
||||||
configProperties = readConfig()
|
configProperties = readConfig()
|
||||||
|
|
||||||
outList = []
|
outList = []
|
||||||
for tag in today_tags:
|
for tag in today_tags:
|
||||||
val = readTag(configProperties['PLC_IP_ADDRESS'], tag['tag'])[0]
|
val = readTag(configProperties['PLC_IP_ADDRESS'], tag['tag'])[0]
|
||||||
if not math.isnan(val):
|
if not math.isnan(val):
|
||||||
outList.append({'name':tag['name'], 'value':val})
|
outList.append({'name':tag['name'], 'value':val})
|
||||||
|
|
||||||
|
|
||||||
print outList
|
print outList
|
||||||
return outList
|
return outList
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
Reference in New Issue
Block a user