From 863585842993f8a64c782254e011bb268a452d4e Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 18 Oct 2022 03:53:28 -0300 Subject: sort.py: print errors to stderr Misc: The trailing comma is due to using the opinionated `black` Python formatter (which seems to be a relatively common one). This was the only change made, so the code seems to already be following the format used by this tool. --- contrib/sort.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'contrib/sort.py') diff --git a/contrib/sort.py b/contrib/sort.py index b4e06d345..595ad0536 100755 --- a/contrib/sort.py +++ b/contrib/sort.py @@ -30,7 +30,7 @@ Exit Codes: # Requirements: # python >= 3.6 -from sys import argv, exit as sys_exit +from sys import argv, exit as sys_exit, stderr def sort_alphabetical(original_items): @@ -103,13 +103,16 @@ def main(args): else: fix_profile(filename) except FileNotFoundError: - print(f"[ Error ] Can't find `{filename}'") + print(f"[ Error ] Can't find `{filename}'", file=stderr) exit_code = 1 except PermissionError: - print(f"[ Error ] Can't read/write `{filename}'") + print(f"[ Error ] Can't read/write `{filename}'", file=stderr) exit_code = 1 except Exception as err: - print(f"[ Error ] An error occurred while processing `{filename}': {err}") + print( + f"[ Error ] An error occurred while processing `{filename}': {err}", + file=stderr, + ) exit_code = 1 return exit_code -- cgit v1.2.3-70-g09d2