diff --git a/moulinette/utils/filesystem.py b/moulinette/utils/filesystem.py index d075b83d..e14c9059 100644 --- a/moulinette/utils/filesystem.py +++ b/moulinette/utils/filesystem.py @@ -15,7 +15,7 @@ from moulinette.core import MoulinetteError # Files & directories -------------------------------------------------- -def read_file(file_path): +def read_file(file_path, file_mode="r"): """ Read a regular text file @@ -35,7 +35,7 @@ def read_file(file_path): # Open file and read content try: - with open(file_path, "r") as f: + with open(file_path, file_mode) as f: file_content = f.read() except IOError as e: raise MoulinetteError("cannot_open_file", file=file_path, error=str(e))