-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Description
I recently started using traceback-with-variables and noticed some inconsistencies in behavior when using different methods to enable traceback enhancements. I would like to clarify whether these behaviors are intended and suggest an improvement for configuring global variable printing more conveniently.
Findings
1. Clickable Stack Trace Navigation
- When I import
tb.a
at the top of my script and run it with:
python my_script.py
I can Cmd+Click (or Ctrl+Click) on file paths in the traceback output to quickly navigate to the corresponding code in my terminal.
- However, if I only use:
traceback-with-variables my_script.py
without importing anything, the traceback is still enhanced, but the file paths are not clickable.
- Question: Is this expected behavior? If so, could it be documented more explicitly?
2. Global Variable Printing Behavior
- Running with:
traceback-with-variables my_script.py
prints global variables by default. But cannot click on it.
- Running with:
import tb.a
at the top and executing:
python my_script.py
does NOT print global variables (which is sometimes undesirable). But can click on it.
- The only way I found to enable global variable printing while still using
python my_script.py
so that I can click is to use:
from traceback_with_variables import global_print_exc
global_print_exc()
at the top of my script instead of import tb.a
.
Suggestion
-
The current method of configuring global variable printing is too complex. Sometimes I need global variables, and sometimes I don't, but right now the only way to configure this is by changing the import statements in my code.
-
Proposal: Could we introduce a new alias, such as:
import tb.ag # Equivalent to `import tb.a`, but enables global variable printing
- This would make it much easier to switch between "with globals" and "without globals" modes, without modifying multiple lines of code, while can click on the traceback to nevigate.