From 9b4575e3077d079746ef81d4057032576addc621 Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Tue, 2 May 2023 11:12:21 +0200 Subject: [PATCH] nanovna-saver.py: fix execution from outside source directory (#632) nanovna-saver.py can be called from outside the source directory. The module import path needs to be resolved relative to the source directory, not relative to the current working directory of the process. Fixes: b0110002 ("moved to pyscaffold directory structure") --- nanovna-saver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nanovna-saver.py b/nanovna-saver.py index eabbcf3..3445c4f 100755 --- a/nanovna-saver.py +++ b/nanovna-saver.py @@ -17,6 +17,7 @@ # along with this program. If not, see . from contextlib import suppress +import os # noinspection PyUnresolvedReferences with suppress(ImportError): @@ -29,7 +30,7 @@ try: except ModuleNotFoundError: import sys - sys.path.append("src") + sys.path.append(os.path.join(os.path.dirname(__file__), "src")) from NanoVNASaver.__main__ import main