CadQuery / CQ-editor

CadQuery GUI editor based on PyQT
Apache License 2.0
723 stars 111 forks source link

When exception is raised, the "Current traceback" window is empty #429

Closed zwn closed 1 month ago

zwn commented 5 months ago

See result when raising `RuntimeError('example').

image

I need to run the script outside of cq-editor to get the stack trace in console.

I am on Debian, installed cq-editor with micromamba:

cq-editor                             master           0.2_60_g7d74cf7        cadquery 
lifeisafractal commented 4 months ago

I'm seeing the same issue. I'm on Ubuntu 23.10 using miniforge:

cq-editor                 master          0.2_61_g03df6fa    cadquery
smurfix commented 3 months ago

Quick fix for this:

diff --git cq_editor/widgets/traceback_viewer.py cq_editor/widgets/traceback_viewer.py
index d5e0baa..4b1043d 100644
--- cq_editor/widgets/traceback_viewer.py
+++ cq_editor/widgets/traceback_viewer.py
@@ -56,6 +56,6 @@ class TracebackPane(QWidget,ComponentMixin):
             root = self.tree.root
             code = code.splitlines()
-            tb = [t for t in extract_tb(tb) if '<string>' in t.filename] #ignore highest frames (debug, exec)
+            tb = [t for t in extract_tb(tb) if 'string>' in t.filename] #ignore highest frames (debug, exec)

             for el in tb:
                 #workaround of the traceback module
smurfix commented 3 months ago

I opened PR #431 with a better fix that doesn't suppress tracebacks in called modules.

They're too helpful for finding the actual problem …