diff --git a/lib/python/qmk/cli/chibios/confmigrate.py b/lib/python/qmk/cli/chibios/confmigrate.py index b9cfda9614..06c2c5e4f1 100644 --- a/lib/python/qmk/cli/chibios/confmigrate.py +++ b/lib/python/qmk/cli/chibios/confmigrate.py @@ -145,17 +145,17 @@ def chibios_confmigrate(cli): if "CHCONF_H" in input_defs["dict"] or "_CHCONF_H_" in input_defs["dict"]: migrate_chconf_h(to_override, outfile=sys.stdout) if cli.args.overwrite: - with open(cli.args.input, "w") as out_file: + with open(cli.args.input, "w", newline='\n') as out_file: migrate_chconf_h(to_override, outfile=out_file) elif "HALCONF_H" in input_defs["dict"] or "_HALCONF_H_" in input_defs["dict"]: migrate_halconf_h(to_override, outfile=sys.stdout) if cli.args.overwrite: - with open(cli.args.input, "w") as out_file: + with open(cli.args.input, "w", newline='\n') as out_file: migrate_halconf_h(to_override, outfile=out_file) elif "MCUCONF_H" in input_defs["dict"] or "_MCUCONF_H_" in input_defs["dict"]: migrate_mcuconf_h(to_override, outfile=sys.stdout) if cli.args.overwrite: - with open(cli.args.input, "w") as out_file: + with open(cli.args.input, "w", newline='\n') as out_file: migrate_mcuconf_h(to_override, outfile=out_file) diff --git a/lib/python/qmk/cli/kle2json.py b/lib/python/qmk/cli/kle2json.py index 8ca574c64f..53cd9ac1f8 100755 --- a/lib/python/qmk/cli/kle2json.py +++ b/lib/python/qmk/cli/kle2json.py @@ -140,7 +140,7 @@ def kle2json(cli): keyboard_dir.mkdir(exist_ok=True, parents=True) info_json_file = keyboard_dir / 'info.json' - json.dump(kb_info_json, info_json_file.open('w'), indent=4, separators=(', ', ': '), sort_keys=False, cls=InfoJSONEncoder) + json.dump(kb_info_json, info_json_file.open('w', newline='\n'), indent=4, separators=(', ', ': '), sort_keys=False, cls=InfoJSONEncoder) cli.log.info('Wrote file {fg_cyan}%s', info_json_file) # Generate and write a keymap @@ -165,5 +165,5 @@ def kle2json(cli): } keymap_path.mkdir(exist_ok=True, parents=True) - json.dump(keymap_json, keymap_file.open('w'), indent=4, separators=(', ', ': '), sort_keys=False) + json.dump(keymap_json, keymap_file.open('w', newline='\n'), indent=4, separators=(', ', ': '), sort_keys=False) cli.log.info('Wrote file %s', keymap_file)