diff --git a/bazarr.py b/bazarr.py index 58284ca09..7e75272b0 100644 --- a/bazarr.py +++ b/bazarr.py @@ -60,7 +60,7 @@ def start_bazarr(): ep = subprocess.Popen(script, stdout=None, stderr=None, stdin=subprocess.DEVNULL, env=os.environ) print(f"Bazarr starting child process with PID {ep.pid}...") return ep - + def terminate_child(): print(f"Terminating child process with PID {child_process.pid}") @@ -69,7 +69,7 @@ def terminate_child(): def get_stop_status_code(input_file): try: - with open(input_file,'r') as file: + with open(input_file, 'r') as file: # read status code from file, if it exists line = file.readline() try: @@ -77,7 +77,7 @@ def get_stop_status_code(input_file): except (ValueError, TypeError): status_code = EXIT_NORMAL file.close() - except: + except Exception: status_code = EXIT_NORMAL return status_code @@ -87,9 +87,9 @@ def check_status(): if os.path.exists(stop_file): status_code = get_stop_status_code(stop_file) try: - print(f"Deleting stop file...") + print("Deleting stop file...") os.remove(stop_file) - except Exception as e: + except Exception: print('Unable to delete stop file.') finally: terminate_child() @@ -97,13 +97,13 @@ def check_status(): if os.path.exists(restart_file): try: - print(f"Deleting restart file...") + print("Deleting restart file...") os.remove(restart_file) except Exception: print('Unable to delete restart file.') finally: terminate_child() - print(f"Bazarr is restarting...") + print("Bazarr is restarting...") child_process = start_bazarr() @@ -116,7 +116,7 @@ def interrupt_handler(signum, frame): interrupted = True print('Handling keyboard interrupt...') else: - print(f"Stop doing that! I heard you the first time!") + print("Stop doing that! I heard you the first time!") if __name__ == '__main__': @@ -148,5 +148,5 @@ if __name__ == '__main__': time.sleep(5) except (KeyboardInterrupt, SystemExit, ChildProcessError): # this code should never be reached, if signal handling is working properly - print(f'Bazarr exited main script file via keyboard interrupt.') + print('Bazarr exited main script file via keyboard interrupt.') exit_program(EXIT_INTERRUPT)