From dbf64faee846aee247e2d54be11623424288c000 Mon Sep 17 00:00:00 2001 From: Alice Date: Sun, 27 Sep 2020 16:46:47 -0500 Subject: [PATCH] Remove unicode conversion (#11) Fixes issue #9 but keeps unicode conversion for python2 users. --- octoprint_klipper/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/octoprint_klipper/__init__.py b/octoprint_klipper/__init__.py index d24b3ef..fa3f6d9 100644 --- a/octoprint_klipper/__init__.py +++ b/octoprint_klipper/__init__.py @@ -19,6 +19,7 @@ import octoprint.plugin import octoprint.plugin.core import glob import os +import sys from octoprint.util.comm import parse_firmware_line from .modules import KlipperLogAnalyzer import flask @@ -100,7 +101,8 @@ class KlipperPlugin( filepath = os.path.expanduser( self._settings.get(["configuration", "configpath"]) ) - data["config"] = data["config"].encode('utf-8') + if sys.version_info[0] < 3: + data["config"] = data["config"].encode('utf-8') f = open(filepath, "w") f.write(data["config"])