From 3718d0952a3543e32b187a9158712a4ad43d826a Mon Sep 17 00:00:00 2001 From: Jason Bruce Date: Thu, 18 Apr 2019 11:44:54 -0400 Subject: [PATCH 1/4] - first stab at getting code python3 compliant --- README.md | 2 +- kiln-controller.py | 6 +++--- lib/ovenWatcher.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1048f82..b17f1df 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Download [NOOBs](https://www.raspberrypi.org/downloads/noobs/). Copy files to an $ sudo apt-get install python-pip python-dev libevent-dev python-virtualenv $ git clone https://github.com/jbruce12000/kiln-controller.git $ cd kiln-controller - $ virtualenv venv + $ virtualenv -p python3 venv $ source venv/bin/activate $ pip install greenlet bottle gevent gevent-websocket diff --git a/kiln-controller.py b/kiln-controller.py index b5a8978..1a061b8 100755 --- a/kiln-controller.py +++ b/kiln-controller.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import os import sys @@ -18,8 +18,8 @@ try: import config sys.dont_write_bytecode = False except: - print "Could not import config file." - print "Copy config.py.EXAMPLE to config.py and adapt it for your setup." + print ("Could not import config file.") + print ("Copy config.py.EXAMPLE to config.py and adapt it for your setup.") exit(1) logging.basicConfig(level=config.log_level, format=config.log_format) diff --git a/lib/ovenWatcher.py b/lib/ovenWatcher.py index 1f6c1bf..beca03a 100644 --- a/lib/ovenWatcher.py +++ b/lib/ovenWatcher.py @@ -66,10 +66,10 @@ class OvenWatcher(threading.Thread): 'log': self.lastlog_subset(), #'started': self.started } - print backlog + print (backlog) backlog_json = json.dumps(backlog) try: - print backlog_json + print (backlog_json) observer.send(backlog_json) except: log.error("Could not send backlog to new observer") From 5118c9f1c359544407a434b3b2a858281639f685 Mon Sep 17 00:00:00 2001 From: Jason Bruce Date: Thu, 18 Apr 2019 11:57:29 -0400 Subject: [PATCH 2/4] more for python3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b17f1df..207f3c4 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ My controller plugs into the wall, and the kiln plugs into the controller. Download [NOOBs](https://www.raspberrypi.org/downloads/noobs/). Copy files to an SD card. Install raspbian on RPi using NOOBs. - $ sudo apt-get install python-pip python-dev libevent-dev python-virtualenv + $ sudo apt-get install python3-pip python3-dev python3-virtualenv libevent-dev $ git clone https://github.com/jbruce12000/kiln-controller.git $ cd kiln-controller $ virtualenv -p python3 venv From 6746155e7e7c927d354263af8f05c06da778a439 Mon Sep 17 00:00:00 2001 From: Jason Bruce Date: Thu, 18 Apr 2019 14:57:56 -0400 Subject: [PATCH 3/4] - another docs fix for python3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 207f3c4..91cbd8e 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Download [NOOBs](https://www.raspberrypi.org/downloads/noobs/). Copy files to an If you want to deploy the code on a PI for production: $ cd kiln-controller - $ virtualenv venv + $ virtualenv -p python3 venv $ source venv/bin/activate $ pip install RPi.GPIO From 8046d9c2141e7fa1f2b0da6c267c5459193397b5 Mon Sep 17 00:00:00 2001 From: Jason Bruce Date: Wed, 24 Apr 2019 22:33:00 -0400 Subject: [PATCH 4/4] - bug with skipping data, index must be an int --- lib/ovenWatcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ovenWatcher.py b/lib/ovenWatcher.py index beca03a..d26be62 100644 --- a/lib/ovenWatcher.py +++ b/lib/ovenWatcher.py @@ -39,7 +39,7 @@ class OvenWatcher(threading.Thread): totalpts = len(self.last_log) if (totalpts <= maxpts): return self.last_log - every_nth = totalpts / (maxpts - 1) + every_nth = int(totalpts / (maxpts - 1)) return self.last_log[::every_nth] def record(self, profile):