From b1cdadde31283916f87e8e3ab1c8a60c13f06941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Urba=C5=84czyk?= Date: Mon, 29 Jun 2020 21:54:08 +0200 Subject: [PATCH] Fix pythonpath update for relative file paths (#158) * Fix pythonpath update for relative file paths * Add script path at the beginning * Add typing_extensions to CI reqs --- cq_editor/widgets/debugger.py | 4 ++-- cqgui_env.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cq_editor/widgets/debugger.py b/cq_editor/widgets/debugger.py index b7398fbe..cbecd3a3 100644 --- a/cq_editor/widgets/debugger.py +++ b/cq_editor/widgets/debugger.py @@ -178,9 +178,9 @@ def compile_code(self,cq_script): def _exec(self, code, locals_dict, globals_dict): with ExitStack() as stack: - p = Path(self.parent().components['editor'].filename).dirname() + p = Path(self.parent().components['editor'].filename).abspath().dirname() if self.preferences['Add script dir to path'] and p: - sys.path.append(p) + sys.path.insert(0,p) stack.callback(sys.path.remove, p) if self.preferences['Change working dir to script dir'] and p: stack.enter_context(p) diff --git a/cqgui_env.yml b/cqgui_env.yml index 917dc819..00908eb7 100644 --- a/cqgui_env.yml +++ b/cqgui_env.yml @@ -17,6 +17,7 @@ dependencies: - requests - nomkl - ezdxf + - typing_extensions - pip - pip: - "https://github.com/CadQuery/cadquery/archive/master.zip"