Skip to content

Commit

Permalink
Newlines (#1)
Browse files Browse the repository at this point in the history
* open with universal newlines
* write with CR-LF
  • Loading branch information
Matthieu Berthomé committed Jan 2, 2021
1 parent 67f015c commit cc9d3d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mklist/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_parts_lst(parts_dir, mode):
filename = os.path.basename(part)
number, _ = os.path.splitext(filename)
try:
with io.open(part, 'r', newline='\r\n', encoding='utf-8') as part_file:
with open(part, 'rU', encoding='utf-8') as part_file:
header = part_file.readline()
header_description = header[2:]
if '~Moved' in header:
Expand Down Expand Up @@ -71,4 +71,4 @@ def generate_parts_lst(mode, parts_folder_path, parts_lst_path):
parts_lst = get_parts_lst(parts_folder_path, mode)

lines = [line_format(**row) for row in parts_lst]
io.open(parts_lst_path, 'w', encoding='utf-8').writelines(lines)
open(parts_lst_path, 'w', newline='\r\n', encoding='utf-8').writelines(lines)

0 comments on commit cc9d3d7

Please sign in to comment.