Skip to content
Snippets Groups Projects
Commit 58203038 authored by Mario's avatar Mario
Browse files

Fixed issue 'labRemote not found'

parent f2a5f136
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,12 @@ from influxdb import InfluxDBClient, exceptions
# LR stuff
LABREMOTE = 1
try:
import _labRemote as labRemote
import labRemote
except:
LABREMOTE = 0
try:
import _labRemote as labRemote
except:
LABREMOTE = 0
......@@ -331,16 +334,20 @@ if __name__ == "__main__":
sys.path.append(lrLibPath)
try:
import _labRemote as labRemote
import labRemote
except:
print("Couldn't find the labRemote Python libraries. Make sure to add them to your $PYTHONPATH first by either doing")
print()
print(" export PYTHONPATH=/path/to/labRemote/build/lib:$PYTHONPATH")
print()
print(" or writing \"/path/to/labRemote/build/lib\" in \"" + args.equip + "\"")
print()
print("And make sure also that you have previously built labRemote enabling the Python bindings (cmake3 -DUSE_PYTHON=on)")
exit(1)
try:
import _labRemote as labRemote
except:
print("Couldn't find the labRemote Python libraries. Make sure to add them to your $PYTHONPATH first by either doing")
print()
print(" export PYTHONPATH=/path/to/labRemote/build/lib:$PYTHONPATH")
print()
print(" or writing \"/path/to/labRemote/build/lib\" in \"" + args.equip + "\"")
print()
print("And make sure also that you have previously built labRemote enabling the Python bindings (cmake3 -DUSE_PYTHON=on)")
exit(1)
uploadToInflux = False
......
......@@ -46,9 +46,12 @@ dpColumnName = "Dew Point (ch.Carrier in) [C]"
# LR stuff
LABREMOTE = 1
try:
import _labRemote as labRemote
import labRemote
except:
LABREMOTE = 0
try:
import _labRemote as labRemote
except:
LABREMOTE = 0
# misc
......@@ -92,44 +95,47 @@ def power_on(hw, ps, args):
def power_off(hw, ps, args):
if (args.force):
ps.turnOff()
print("[ info ][ps] ps off")
return
t = getFromInflux(temperatureSink, "select last(" + tColumnName + ") from " + temperatureSink["measurement"])
dp = getFromInflux(dewpointSink, "select last(\"" + dpColumnName + "\") from " + dewpointSink["measurement"])
if t == [] or dp == []:
print("[ error ][ps] couldn't find T or DP data in influxDB. The retrieved values are")
print("[ info ][ps] T = {} DP = {}".format(t, dp))
print("[ qstn ][ps] turn off the PS anyway?")
ans = input ("y/n: ")
if ans == 'y':
ps.turnOff()
print("[ info ][ps] ps off")
return
else:
print("[ info ][ps] ok!")
return
t = t[0][0]["last"]
dp = dp[0][0]["last"]
print("[ info ][ps] T = {:.2f}; dp = {:.2f}".format(t, dp))
diff = t - dp
if diff < maxDiffBetweenTandDPtoTurnTheHVoff:
print("[ warn ][ps] (T - DP) = {:.2f}, which is smaller than {}. Cannot power off the PS in these conditions".format(diff, maxDiffBetweenTandDPtoTurnTheHVoff))
else:
ps.turnOff()
print("[ info ][ps] ps off")
ps.turnOff()
return 0
return
# if (args.force):
# ps.turnOff()
# print("[ info ][ps] ps off")
# return
#
#
# t = getFromInflux(temperatureSink, "select last(" + tColumnName + ") from " + temperatureSink["measurement"])
# dp = getFromInflux(dewpointSink, "select last(\"" + dpColumnName + "\") from " + dewpointSink["measurement"])
#
# if t == [] or dp == []:
# print("[ error ][ps] couldn't find T or DP data in influxDB. The retrieved values are")
# print("[ info ][ps] T = {} DP = {}".format(t, dp))
# print("[ qstn ][ps] turn off the PS anyway?")
#
# ans = input ("y/n: ")
# if ans == 'y':
# ps.turnOff()
# print("[ info ][ps] ps off")
# return
# else:
# print("[ info ][ps] ok!")
# return
#
#
#
# t = t[0][0]["last"]
# dp = dp[0][0]["last"]
#
# print("[ info ][ps] T = {:.2f}; dp = {:.2f}".format(t, dp))
#
# diff = t - dp
# if diff < maxDiffBetweenTandDPtoTurnTheHVoff:
# print("[ warn ][ps] (T - DP) = {:.2f}, which is smaller than {}. Cannot power off the PS in these conditions".format(diff, maxDiffBetweenTandDPtoTurnTheHVoff))
# else:
# ps.turnOff()
# print("[ info ][ps] ps off")
#
# return
def measure(hw, ps, args):
# Takes data and pushes it to influxdb
......@@ -356,16 +362,19 @@ if __name__ == "__main__":
sys.path.append(lrLibPath)
try:
import _labRemote as labRemote
import labRemote
except:
print("Couldn't find the labRemote Python libraries. Make sure to add them to your $PYTHONPATH first by either doing")
print()
print(" export PYTHONPATH=/path/to/labRemote/build/lib:$PYTHONPATH")
print()
print(" or writing \"/path/to/labRemote/build/lib\" in \"" + args.equip + "\"")
print()
print("And make sure also that you have previously built labRemote enabling the Python bindings (cmake3 -DUSE_PYTHON=on)")
exit(1)
try:
import _labRemote as labRemote
except:
print("Couldn't find the labRemote Python libraries. Make sure to add them to your $PYTHONPATH first by either doing")
print()
print(" export PYTHONPATH=/path/to/labRemote/build/lib:$PYTHONPATH")
print()
print(" or writing \"/path/to/labRemote/build/lib\" in \"" + args.equip + "\"")
print()
print("And make sure also that you have previously built labRemote enabling the Python bindings (cmake3 -DUSE_PYTHON=on)")
exit(1)
# - - - - - - - - - -
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment