From aff06a671e0fe7866e52196e2c45ee8766c3e767 Mon Sep 17 00:00:00 2001 From: MadcowOG Date: Wed, 4 May 2022 00:59:21 -0700 Subject: [PATCH] Remebered why I put the open inside the try block --- app/request.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/request.py b/app/request.py index b9bd3ca..eb7ed68 100644 --- a/app/request.py +++ b/app/request.py @@ -38,13 +38,14 @@ class TorError(Exception): def send_tor_signal(signal: Signal, confloc='./misc/tor/control.conf') -> bool: - with open(confloc, "r") as conf: - for line in conf: - pass - secret = line - conf.close() + try: # Try to authenticate with password. + with open(confloc, "r") as conf: + for line in conf: + pass + secret = line + conf.close() with Controller.from_port(port=9051) as c: authenticate_password(c, password=secret) c.signal(signal)