From 6d18976b3da63be1e60737784f4a0e04ae24a04e Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Thu, 19 Mar 2026 18:11:39 +0100 Subject: [PATCH 1/7] Remove ruff warnings in VScode --- python/pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/pyproject.toml b/python/pyproject.toml index 05a2b26e6..b61f27824 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -42,6 +42,9 @@ indent-width = 4 # Assume Python 3.9 target-version = "py39" +# _ is the i18n/gettext builtin injected at runtime +builtins = ["_"] + [tool.ruff.lint] # Enable preview mode, allow os.env changes before imports preview = true From 6c7d78f5eb6faf6c521d18d2401d74f1e8906f8f Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Thu, 19 Mar 2026 18:12:27 +0100 Subject: [PATCH 2/7] Fix error in comets, related to string coercion --- python/PiFinder/comets.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/PiFinder/comets.py b/python/PiFinder/comets.py index 9430094ff..e8734fc36 100644 --- a/python/PiFinder/comets.py +++ b/python/PiFinder/comets.py @@ -4,6 +4,7 @@ from skyfield.constants import GM_SUN_Pitjeva_2005_km3_s2 as GM_SUN from PiFinder.utils import Timer, comet_file from PiFinder.calc_utils import sf_utils +import pandas as pd import requests import os import logging @@ -198,6 +199,14 @@ def calc_comets( .set_index("designation", drop=False) ) + # groupby/last can coerce numeric columns to strings when NaN values + # are present; ensure perihelion date fields are numeric before use + for col in ("perihelion_year", "perihelion_month", "perihelion_day"): + comets_df[col] = pd.to_numeric(comets_df[col], errors="coerce") + comets_df = comets_df.dropna( + subset=["perihelion_year", "perihelion_month", "perihelion_day"] + ) + # Report progress after pandas processing (roughly 66% of setup time) if progress_callback: progress_callback(2) From c0aaa03477300ac78778952580589eb50fb9390f Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Thu, 19 Mar 2026 18:34:48 +0100 Subject: [PATCH 3/7] Use a dynamic path to the data_dir when searching for logs --- python/PiFinder/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/PiFinder/server.py b/python/PiFinder/server.py index ff9db6d14..8fd622bba 100644 --- a/python/PiFinder/server.py +++ b/python/PiFinder/server.py @@ -781,7 +781,7 @@ def logs_page(): def stream_logs(): try: position = int(request.query.get("position", 0)) - log_file = "/home/pifinder/PiFinder_data/pifinder.log" + log_file = str(utils.data_dir / "pifinder.log") try: file_size = os.path.getsize(log_file) From a9e21486f2a84e09ff55f2ae7215cca531b24d24 Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Thu, 19 Mar 2026 18:35:11 +0100 Subject: [PATCH 4/7] Silence warnings in VScode --- .vscode/settings.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..fb57207b6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "python.analysis.diagnosticSeverityOverrides": { + "reportUndefinedVariable": "none" + }, + "files.associations": { + "*logconf*.json": "jsonc" + } +} + From 21cdc3062a1b5a640cb76092f6916d4c9d585b42 Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Thu, 19 Mar 2026 18:41:45 +0100 Subject: [PATCH 5/7] Patch early to avoid pickle errors in interprocess communication --- python/PiFinder/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/PiFinder/main.py b/python/PiFinder/main.py index d447bf66c..c8b00fcd0 100644 --- a/python/PiFinder/main.py +++ b/python/PiFinder/main.py @@ -35,7 +35,6 @@ from PiFinder import config from PiFinder import pos_server from PiFinder import utils -from PiFinder import server from PiFinder import keyboard_interface from PiFinder.multiproclogging import MultiprocLogging @@ -51,6 +50,8 @@ from PiFinder.displays import DisplayBase, get_display +import PiFinder.manager_patch as patch + from typing import Any, TYPE_CHECKING # Mypy i8n fix @@ -124,6 +125,9 @@ def setup_dirs(): os.chmod(Path(utils.data_dir), 0o777) +patch.apply() + + class StateManager(BaseManager): pass @@ -348,10 +352,6 @@ def main( ) langXX.install() - import PiFinder.manager_patch as patch - - patch.apply() - with StateManager() as manager: shared_state = manager.SharedState() # type: ignore[attr-defined] location = shared_state.location() From fb0dbfa3ce9359f0bcb4a842c47af9870ff5c4b0 Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Fri, 20 Mar 2026 08:03:44 +0100 Subject: [PATCH 6/7] Fix: Import server again --- python/PiFinder/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/PiFinder/main.py b/python/PiFinder/main.py index c8b00fcd0..83577e524 100644 --- a/python/PiFinder/main.py +++ b/python/PiFinder/main.py @@ -35,6 +35,7 @@ from PiFinder import config from PiFinder import pos_server from PiFinder import utils +from PiFinder import server from PiFinder import keyboard_interface from PiFinder.multiproclogging import MultiprocLogging From a6053266a7c282b0af4e1e6e4731dbc70ea46942 Mon Sep 17 00:00:00 2001 From: Jens Scheidtmann Date: Fri, 20 Mar 2026 08:05:02 +0100 Subject: [PATCH 7/7] Fix: collect early logging also in log file --- python/PiFinder/multiproclogging.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/PiFinder/multiproclogging.py b/python/PiFinder/multiproclogging.py index 92d36dccd..83b7f4376 100644 --- a/python/PiFinder/multiproclogging.py +++ b/python/PiFinder/multiproclogging.py @@ -87,6 +87,10 @@ def start(self, initial_queue: Optional[Queue] = None): len(self._queues) >= 1 ), "No queues in use. You should have requested at least one queue." + # Create the main-process queue BEFORE starting the sink so the sink + # receives it in its queue list and monitors it. + queue = initial_queue if initial_queue is not None else self.get_queue() + self._proc = Process( target=self._run_sink, args=( @@ -97,7 +101,6 @@ def start(self, initial_queue: Optional[Queue] = None): # Start separate process that consumes from the queues. self._proc.start() # Now in this process we can divert logging to the newly created class - queue = self.get_queue() MultiprocLogging.configurer(queue) def join(self):