From 85d1a37ba3141fcf7222bfda6587d1d943fe9253 Mon Sep 17 00:00:00 2001 From: Lemon Rose <78662983+japandotorg@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:36:30 +0530 Subject: [PATCH] [Screenshot] fix logs --- screenshot/common/__init__.py | 2 +- screenshot/common/downloader.py | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/screenshot/common/__init__.py b/screenshot/common/__init__.py index 3b07a94..352ad0d 100644 --- a/screenshot/common/__init__.py +++ b/screenshot/common/__init__.py @@ -67,7 +67,7 @@ def get_service(self) -> Service: return Service( executable_path=str(self.cog.manager.driver_location), service_args=["--log", "debug"], - log_output=str(self.cog.manager.logs_directory / "gecko.log"), + log_output=str(self.cog.manager.data_directory / "gecko.log"), ) def get_options(self) -> Options: diff --git a/screenshot/common/downloader.py b/screenshot/common/downloader.py index 48dd5a2..9822b93 100644 --- a/screenshot/common/downloader.py +++ b/screenshot/common/downloader.py @@ -72,19 +72,13 @@ def __init__(self, session: Optional[aiohttp.ClientSession] = None) -> None: def __environ(self) -> Dict[str, str]: environ: Dict[str, str] = os.environ.copy() if self.tor_location: - environ["LD_LIBRARY_PATH"] = ( - os.getenv("LD_LIBRARY_PATH", "") + ":" + str(self.tor_location / "tor") - ) + environ["LD_LIBRARY_PATH"] = str(self.tor_location / "tor") return environ @property def data_directory(self) -> pathlib.Path: return data_manager.cog_data_path(raw_name="Screenshot") / "data" - @property - def logs_directory(self) -> pathlib.Path: - return self.data_directory / "logs" - @property def driver_location(self) -> Optional[pathlib.Path]: return ( @@ -359,7 +353,7 @@ async def download_and_extract_tor(self) -> None: Log debug file {} DataDirectory {} """.format( - self.logs_directory / "tor.log", self.tor_location / "teb-data" + self.data_directory / "tor.log", self.tor_location / "teb-data" ) ) log.info("Downloaded tor successfully with location: {}".format(self.tor_location))