summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Buesch <m@bues.ch>2019-11-23 14:42:48 +0100
committerMichael Buesch <m@bues.ch>2019-11-23 14:42:48 +0100
commit5731262801be97a2eee35c942467f4cb43505bcc (patch)
tree9e2bfdb671de2f2c655fdb9363486617b730aae7
parent50ca54f0eb62dcb23a3436a4352a2f486682b26e (diff)
downloadcnc-5731262801be97a2eee35c942467f4cb43505bcc.tar.xz
cnc-5731262801be97a2eee35c942467f4cb43505bcc.zip
pctl: More Python3 fixes
Signed-off-by: Michael Buesch <m@bues.ch>
-rwxr-xr-xpressure_control/remote/pctl-remote5
1 files changed, 4 insertions, 1 deletions
diff --git a/pressure_control/remote/pctl-remote b/pressure_control/remote/pctl-remote
index 93e4705..59f2e40 100755
--- a/pressure_control/remote/pctl-remote
+++ b/pressure_control/remote/pctl-remote
@@ -132,16 +132,19 @@ class LogFile(QObject):
if not logfileName:
return
try:
- self.fd = file(logfileName, "w+b")
+ self.fd = open(logfileName, "w+b")
except IOError as e:
print("Failed to open logfile %s: %s" % (logfileName, e.strerror))
sys.exit(1)
self.write("X/Y,X/Y lower threshold,X/Y upper threshold,"+\
"Z,Z lower threshold,Z upper threshold,\n")
+ print("Logging to: %s" % logfileName)
def write(self, message):
if not self.fd:
return
+ if isinstance(message, str):
+ message = message.encode("UTF-8", "ignore")
self.fd.write(message)
self.fd.flush()
bues.ch cgit interface