Another import bug. This time if --version doesn't return a patch number.

This commit is contained in:
sliptonic
2022-06-28 15:10:49 -05:00
parent 02718d99bb
commit ade72dc869
2 changed files with 11 additions and 6 deletions

View File

@@ -89,6 +89,7 @@ class PathWorkbench(Workbench):
import PathCommands
import subprocess
from packaging.version import Version, parse
PathGuiInit.Startup()
@@ -162,11 +163,11 @@ class PathWorkbench(Workbench):
r = subprocess.run(
["camotics", "--version"], capture_output=True, text=True
).stderr.strip()
major, minor, patch = r.split(".")
if int(major) >= 1 and int(minor) >= 2 and int(patch) >= 2:
# subprocess.call(["camsim", "-v"])
v = parse(r)
if v >= Version("1.2.2"):
toolcmdlist.append("Path_Camotics")
except FileNotFoundError:
except (FileNotFoundError, ModuleNotFoundError):
pass
try:

View File

@@ -78,14 +78,18 @@ def Startup():
from PathScripts import PathUtilsGui
from PathScripts import PathVcarveGui
from packaging.version import Version, parse
# If camotics is installed and current enough, import the GUI
try:
import camotics
r = subprocess.run(
["camotics", "--version"], capture_output=True, text=True
).stderr.strip()
major, minor, patch = r.split(".")
if int(major) >= 1 and int(minor) >= 2 and int(patch) >= 2:
v = parse(r)
if v >= Version("1.2.2"):
from PathScripts import PathCamoticsGui
except (FileNotFoundError, ModuleNotFoundError):
pass