From c4a09c42ccb4455e502c5107a331533fb3e2a1a1 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 3 May 2018 14:19:43 -0700 Subject: [PATCH] workspace read and write needs UTF-8 conversion reading needs to decode the bytes to str and writing needs to encode the str to bytes. --- src/pylorax/api/workspace.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pylorax/api/workspace.py b/src/pylorax/api/workspace.py index 6d9a9c8f..44952c07 100644 --- a/src/pylorax/api/workspace.py +++ b/src/pylorax/api/workspace.py @@ -56,7 +56,7 @@ def workspace_read(repo, branch, recipe_name): return None try: f = open(filename, 'rb') - recipe = recipe_from_toml(f.read()) + recipe = recipe_from_toml(f.read().decode("UTF-8")) except IOError: raise RecipeFileError return recipe @@ -78,7 +78,7 @@ def workspace_write(repo, branch, recipe): if not os.path.isdir(ws_dir): os.makedirs(ws_dir) filename = joinpaths(ws_dir, recipe.filename) - open(filename, 'wb').write(recipe.toml()) + open(filename, 'wb').write(recipe.toml().encode("UTF-8")) def workspace_delete(repo, branch, recipe_name):