diff --git a/helper.py b/helper.py index 55244a0..c9e0fe4 100644 --- a/helper.py +++ b/helper.py @@ -404,6 +404,9 @@ def write(self, path, data, m='wb'): # append to local file def append(self, path, data): + # Ensure data is in bytes format + if isinstance(data, str): + data = data.encode('utf-8') self.write(path, data, 'ab+') # ---------------------------------------------------------------------- diff --git a/pjl.py b/pjl.py index e644d37..4426894 100644 --- a/pjl.py +++ b/pjl.py @@ -738,7 +738,7 @@ def do_nvram(self, arg): commands = ["@PJL RNVRAM ADDRESS=" + str(n) for n in memspace] self.chitchat("Writing copy to " + lpath) if os.path.isfile(lpath): - file().write(lpath, "") # empty file + file().write(lpath, b"") # empty file for chunk in list(chunks(commands, steps)): str_recv = self.cmd(c.EOL.join(chunk)) if not str_recv: