Skip to content

Commit

Permalink
Add encoding to readers (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Ramon <ramon.guimera@skyscanner.net>
  • Loading branch information
w0rmr1d3r and Ramon committed Nov 12, 2022
1 parent edc4ef6 commit b6329fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion finance_tracker/categories/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def all_categories():
current_path = pathlib.Path(__file__).parent.resolve()
with open(f"{current_path}/../../load/categories/categories.json") as file:
with open(f"{current_path}/../../load/categories/categories.json", "r", encoding="ASCII") as file:
return json.load(file)


Expand Down
2 changes: 1 addition & 1 deletion finance_tracker/readers/entry_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def float_in_str_to_str(to_convert: str) -> float:
# todo - test
def read_entries_from_file(self, headers_to_ignore: int, path_to_file: str) -> list[Entry]:
entries = []
with open(path_to_file, "r") as file:
with open(path_to_file, "r", encoding="UTF-8") as file:
csvreader = csv.reader(file, dialect="excel", delimiter=";")
for _ in range(headers_to_ignore):
next(csvreader)
Expand Down
2 changes: 1 addition & 1 deletion finance_tracker/readers/revolut_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RevolutReader(BaseReader):

def read_from_file(self, path_to_file: str) -> list:
entries = []
with open(path_to_file, "r") as file:
with open(path_to_file, "r", encoding="ASCII") as file:
csvreader = csv.reader(file, dialect="excel", delimiter=",")
for _ in range(self._HEADERS_TO_IGNORE):
next(csvreader)
Expand Down

0 comments on commit b6329fa

Please sign in to comment.