alekssadowski95 / FreeCAD-Beginner-Assistant

Gives realtime and asynchronous feedback to parts created in the FreeCAD Part Design and Sketcher workbenches.
GNU Lesser General Public License v2.1
10 stars 5 forks source link

str vs int comparison #14

Closed hasecilu closed 1 month ago

hasecilu commented 1 month ago
15:08:46  Your FreeCAD program version is not up to date: Running the Python command 'Analyse_Document_Command' failed:
Traceback (most recent call last):
  File "/home/uli/.local/share/FreeCAD/Mod/FreeCAD-Beginner-Assistant/./commands.py", line 77, in Activated
    FreeCAD.Console.PrintMessage(str(has_old_freecad_version()) + "\n")
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uli/.local/share/FreeCAD/Mod/FreeCAD-Beginner-Assistant/./assistant.py", line 81, in has_old_freecad_version
    if version_info[0] < major:
       ^^^^^^^^^^^^^^^^^^^^^^^

'<' not supported between instances of 'str' and 'int'
diff --git a/assistant.py b/assistant.py
index 6de9509..88416ec 100644
--- a/assistant.py
+++ b/assistant.py
@@ -78,11 +78,11 @@ def has_old_freecad_version():
     minor = 21
     patch = 2
     version_info = FreeCAD.Version()
-    if version_info[0] < major:
+    if int(version_info[0]) < major:
         return True
-    if version_info[1] < minor:
-        return True
-    if version_info[2] < patch:
+    if int(version_info[1]) < minor:
+        return True
+    if int(version_info[2]) < patch:
         return True
     return False
alekssadowski95 commented 1 month ago

@hasecilu Thank you for your help. Can you submit this as a pull request?