From 3e18a7ea82c507ea6d4ebcbfc356f114ae63a5dc Mon Sep 17 00:00:00 2001 From: Patrick McDonagh Date: Fri, 22 Jan 2016 18:39:15 -0600 Subject: [PATCH] Removed error catching for debugging --- python/tagserver_SQLite.py | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/python/tagserver_SQLite.py b/python/tagserver_SQLite.py index 0ed7d70..ee31115 100644 --- a/python/tagserver_SQLite.py +++ b/python/tagserver_SQLite.py @@ -35,29 +35,29 @@ def main(): for t in tags: tagList.append({"id": int(t[0]), "name": t[1], "val": None, "lastVal": None}) - try: - tux = TuxEIP(libpath="/usr/lib/libtuxeip.so") - sess = tux.OpenSession(PLC_IP_ADDRESS) - reg = tux.RegisterSession(sess) - conn = tux.ConnectPLCOverCNET(sess, LGX, 1, 100, 123, randint(0, 9999), 123, 321, 100, 5000, 1, '01') + # try: + tux = TuxEIP(libpath="/usr/lib/libtuxeip.so") + sess = tux.OpenSession(PLC_IP_ADDRESS) + reg = tux.RegisterSession(sess) + conn = tux.ConnectPLCOverCNET(sess, LGX, 1, 100, 123, randint(0, 9999), 123, 321, 100, 5000, 1, '01') - while True: - for r in tagList: - r["val"] = tux.ReadLGXDataAsFloat(sess, conn, r['name'], 1)[0] - print("{0} - {1}".format(r["name"], r["val"])) - if not r["val"] == r["lastVal"]: - with con: - cur = con.cursor() - aQuery = """INSERT INTO vals (tagID, val) VALUES ('%d', '%f');""" % (r["id"], float(r["val"])) - print(aQuery) - cur.execute(aQuery) - con.commit() - r["lastVal"] = r["val"] + while True: + for r in tagList: + r["val"] = tux.ReadLGXDataAsFloat(sess, conn, r['name'], 1)[0] + print("{0} - {1}".format(r["name"], r["val"])) + if not r["val"] == r["lastVal"]: + with con: + cur = con.cursor() + aQuery = """INSERT INTO vals (tagID, val) VALUES ('%d', '%f');""" % (r["id"], float(r["val"])) + print(aQuery) + cur.execute(aQuery) + con.commit() + r["lastVal"] = r["val"] - time.sleep(scan_rate) - except Exception as err: - print err - pass + time.sleep(scan_rate) + # except Exception as err: + # print err + # pass if __name__ == '__main__': main()