Skip to content

Commit

Permalink
tweak encoding when opening file
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-develop committed Jun 26, 2024
1 parent 4cabccc commit a9af1fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![Nougaro. Un langage de programmation.](repo-image/repo-image.png)

Voici Nougaro bêta `0.22.0`.
Voici Nougaro bêta `0.23.0`.

Nougaro est un langage de programmation, interprété en Python.

Expand Down
4 changes: 2 additions & 2 deletions shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def execute_file(path: str, debug_on: bool, noug_dir: str, version: str, args: l
if debug_on:
print(f"Nougaro working directory is {work_dir} ({type(work_dir)})")

with open(path, encoding="UTF-8") as file:
with open(path, "r+", encoding="UTF-8") as file:
file_content = str(file.read())

if file_content == "": # no need to run this empty file
Expand Down Expand Up @@ -192,7 +192,7 @@ def main():
if not os.path.exists(HISTORY_FILE):
if debug_on:
print(f"[history] creating {HISTORY_FILE}")
with open(HISTORY_FILE, "w+") as histf:
with open(HISTORY_FILE, "w+", encoding="UTF-8") as histf:
histf.write("")
readline.read_history_file(HISTORY_FILE)
atexit.register(readline.write_history_file, HISTORY_FILE)
Expand Down

0 comments on commit a9af1fb

Please sign in to comment.