summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-01-25 18:24:13 +0100
committerGitHub <noreply@github.com>2024-01-25 18:24:13 +0100
commit33b0cdab9e6b7f94e42bd4c2ee13ef8dc5a9f549 (patch)
treeb4f030737c68aaac1ebfdd54ff3dc1cde4b54f17
parent2e60900b1ae4355762f7b59141c1c47f6ffcbc66 (diff)
select elements: message when python path is not correct (#2685)
-rw-r--r--lib/extensions/select_elements.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/extensions/select_elements.py b/lib/extensions/select_elements.py
index 896e04b0..55aae46c 100644
--- a/lib/extensions/select_elements.py
+++ b/lib/extensions/select_elements.py
@@ -7,9 +7,10 @@ import os
import subprocess
import sys
-from inkex import Boolean
+from inkex import Boolean, errormsg
from ..elements import Clone, FillStitch, Polyline, SatinColumn, Stroke
+from ..i18n import _
from ..utils import get_bundled_dir
from .base import InkstitchExtension
@@ -67,17 +68,16 @@ class SelectElements(InkstitchExtension):
# we are running a local install
py_path = sys.executable
- # For some reason we cannot use the subprocess method wait() to finish the process properly
- # and we'll get a warning. It will break functionality of the selection.
- # There is most possibly a better way than to just ignore the warning?!?
- with open(os.devnull, 'w') as null:
- sys.stderr = null
- sys.stdout = null
-
# custom python path
if self.options.python_path:
py_path = self.options.python_path
+ if not os.path.isfile(py_path):
+ errormsg(_("Could not detect python path. "
+ "Please insert python path manually as described in the help tab "
+ "of the select elements dialog."))
+ sys.exit(0)
+
return py_path, file_path
def _get_id_list(self):