From c352f8cea3ba18d4252a1e2d273992aa7427a77e Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Wed, 21 Sep 2022 19:22:14 +0100 Subject: [PATCH] Python3 IO encoding changes --- game/scripts/mods.rpy | 4 ++-- game/scripts/options.rpy | 3 +++ game/scripts/utility/image_crop.rpy | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/game/scripts/mods.rpy b/game/scripts/mods.rpy index 3dcc6da0..9da06a3d 100644 --- a/game/scripts/mods.rpy +++ b/game/scripts/mods.rpy @@ -25,7 +25,7 @@ init python: logo = "#000" # Read manifest - with renpy.file(manifest) as f: + with renpy.open_file(manifest) as f: data = json.load(f) modname = data.get("Name", None) @@ -61,7 +61,7 @@ init python: fn = os.path.split(file)[1] - with renpy.file(file) as s: + with renpy.open_file(file) as s: data = s.read() print "Loading '{}'".format(mod) diff --git a/game/scripts/options.rpy b/game/scripts/options.rpy index fcdaf4b2..e10f6ca2 100644 --- a/game/scripts/options.rpy +++ b/game/scripts/options.rpy @@ -113,6 +113,9 @@ define config.enter_replay_transition = None define config.exit_replay_transition = None define config.say_attribute_transition = d3 +# Python +define config.open_file_encoding = "utf-8" + # Garbage Collector # define config.manage_gc = True # define config.gc_thresholds = (25000, 10, 10) diff --git a/game/scripts/utility/image_crop.rpy b/game/scripts/utility/image_crop.rpy index d30ac0a3..4861b5e0 100644 --- a/game/scripts/utility/image_crop.rpy +++ b/game/scripts/utility/image_crop.rpy @@ -1,6 +1,6 @@ init python: whitespace_dict = {} - with renpy.file("images.whitespace") as fp: + with renpy.open_file("images.whitespace") as fp: line = fp.readline() while line: path, area = line.strip("\r\n").split(':')