From 996abe5a304ace8c63a1e4e2c2bc7e24dde7c8ca Mon Sep 17 00:00:00 2001 From: Jonas Braathen <jonas.braathen@usit.uio.no> Date: Wed, 1 Sep 2021 13:14:15 +0200 Subject: [PATCH] Add missing encoding to open() for fix linting error --- greg/management/commands/stop_notification_publisher.py | 6 +++++- greg/management/commands/stop_schedule_tasks.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/greg/management/commands/stop_notification_publisher.py b/greg/management/commands/stop_notification_publisher.py index 95e41958..03770285 100644 --- a/greg/management/commands/stop_notification_publisher.py +++ b/greg/management/commands/stop_notification_publisher.py @@ -10,7 +10,11 @@ class Command(BaseCommand): def handle(self, *args, **options): try: - with open(settings.NOTIFICATION_PUBLISHER["daemon"]["pid_file"], "r") as f: + with open( + settings.NOTIFICATION_PUBLISHER["daemon"]["pid_file"], + "r", + encoding="utf-8", + ) as f: pid = int(f.read().strip()) os.kill(pid, signal.SIGINT) diff --git a/greg/management/commands/stop_schedule_tasks.py b/greg/management/commands/stop_schedule_tasks.py index ba8af1cd..b04f12e0 100644 --- a/greg/management/commands/stop_schedule_tasks.py +++ b/greg/management/commands/stop_schedule_tasks.py @@ -10,7 +10,11 @@ class Command(BaseCommand): def handle(self, *args, **options): try: - with open(settings.SCHEDULE_TASKS["daemon"]["pid_file"], "r") as f: + with open( + settings.SCHEDULE_TASKS["daemon"]["pid_file"], + "r", + encoding="utf-8", + ) as f: pid = int(f.read().strip()) os.kill(pid, signal.SIGINT) -- GitLab