question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

traceback.print_exc() shows stacktrace of cython layer, but traceback.print_stack() does not

See original GitHub issue

print_exc()

hello.pyx

import traceback

try:
    raise
except:
    traceback.print_exc()

=>

Traceback (most recent call last):
  File "hello.pyx", line 4, in hello (hello.c:1050)
    raise

print_stack()

hello.pyx

import traceback

traceback.print_stack()

=>

  File "/home/sonots/.pyenv/versions/3.6.1/lib/python3.6/traceback.py", line 186, in print_stack
    print_list(extract_stack(f, limit=limit), file=file)

This does not show File "hello.pyx", line 4, in hello (hello.c:1050)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:22 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
robertwbcommented, Nov 14, 2018

Trackebacks are added as the exception propagates upwards; for debugging you could simply raise an exception to see where you are.

0reactions
ghostcommented, May 11, 2019

Is what I tested there useful? Just making sure I actually tried the right thing regarding Stack traces might also "just work" when profiling is enabled hoping it helps establishing whether a new option would make sense or not

Read more comments on GitHub >

github_iconTop Results From Across the Web

traceback — Print or retrieve a stack traceback — Python 3.11 ...
Print exception information and stack trace entries from traceback object tb to file. This differs from print_tb() in the following ways: if tb...
Read more >
How to catch and print the full exception traceback without ...
This doesn't work in Python 3 and needs to be changed to desired_trace = traceback.format_exc() . Passing sys.exc_info() as the argument was never...
Read more >
Print or retrieve a stack traceback — Python 2.7.2 documentation
Print up to limit stack trace entries from traceback. ... This differs from print_tb() in the following ways: (1) if traceback is not...
Read more >
Print or retrieve a stack traceback — Python 3.4.2 documentation
Print exception information and up to limit stack trace entries from traceback to file. This differs from print_tb() in the following ways: if...
Read more >
Python: print stack trace after catching exception - Code Maven
examples/python/stack_trace.py. import traceback; def g():; f(); def f():; raise Exception("hi"); try: g(); except Exception as e: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found