All Questions
Tagged with stack-trace python
152 questions
0
votes
1
answer
69
views
Route works fine in local Docker container, but throws a stack trace error when deployed to CloudRun
I am working on an app in Python, using Selenium WebDriver (with Chrome / ChromeDriver) for web scraping.
My route works fine in a local Docker container (200, with the expected data returned ...
6
votes
1
answer
144
views
Exception stack trace not clickable in PyCharm
PyCharm suddenly changed the way it shows the stack trace on the run tab and does not let me click on the exception (or anywhere else) and go to the specific point of the error file anymore.
How can I ...
0
votes
0
answers
11
views
Get stacktrace including child class method call when exception is raised from parent classmethod
I have a relatively complex codebase that has a Decorator to catch exceptions, log them and prevent some boilerplate code. I also have several Services that inherit from a parent BaseService which has ...
1
vote
0
answers
198
views
Parsing multiline python logs in fluentbit issue
I want to parse some python logs (from aodh-evaluator) with fluentbit and multiline parsing doesn`t work.
This is an example of logs:
2024-01-03 13:49:59.217 1742204 WARNING oslo_db.sqlalchemy.utils [-...
3
votes
0
answers
211
views
How can I get Python stacktraces to show up properly in Google Cloud Trace?
I have a web service written in python, running on GKE. I've enabled opentelemetry instrumentation via FastAPI contrib package, OTel SDK and cloud trace exporter.
I am able to send and view successful ...
0
votes
1
answer
189
views
How do I expand 3 dots in selector in selenium stack trace
Is there a way to expand 3 dots and see full selector in the selenium stacktrace on element click intercepted error? Without it, it is really hard to understand what is blocking the click.
Maybe I ...
0
votes
0
answers
2k
views
FastAPI get exception stacktrace
I have a problem with my Exception handler in my FastAPI app. Here's my current code:
@app.exception_handler(Exception)
async def server_error(request: Request, error: Exception):
logger.error(f&...
-1
votes
1
answer
109
views
I am getting a "'tuple' object has no attribute 'set_width" error and I don't know what to do
first post on stackoverflow, apologies if this is not written correctly
I am pretty new to Python and Very new to Manim. I am a big fan of 3b1b, and was using one of his files from gitlab as a ...
0
votes
1
answer
97
views
how to get a human readable call stack from an ipynb error traceback['stack']?
I'm hitting an error in a notebook and instead of showing a full call stack, it's a truncated stack with only the last few calls and the following message printed on top:
Output exceeds the size limit....
0
votes
1
answer
612
views
Suppress/redirect stack trace print out with logger.exception?
A great way to process exceptions is to use Logger.exception:
try:
do_something()
except BaseException:
logger.exception('some message')
... this not only prints out the user message, but ...
0
votes
0
answers
284
views
How should I read this python traceback/what is causing "breaks" in?
I know what a key error is, and why I am getting it, this question is about what is occurring to the call stack not why I am getting a key error. I am also not looking to know exactly what's happening ...
0
votes
2
answers
515
views
Is there a Python library that shows execution time per line? [closed]
I have found this library called heartrate which shows how many times each line has been hit. I'm wondering if there is a similar library that can show the execution time of each line? Sometimes a ...
1
vote
2
answers
965
views
How to display formatted Jupyter stack trace from "full output data"
I am debugging Python code in VS Code using the Jupyter integration in interactive mode.
The stack trace I get is only partially displayed, because "Output exceeds the size limit." I would ...
0
votes
1
answer
155
views
How to programatically collect a list of all stack traces during function call, not just when exception happens?
In order to debug how a complicated library executes a function call, e.g. pd.Series(np.NaN)|pd.Series("True") I would like to generate a list of all states of the stack during the execution ...
0
votes
0
answers
35
views
I'm making webscraping program with python selenium. but I get error. How can I fix it?
I'm making webscraping program with python selenium that shows my accademy homework when I just run this progra. but I get error
My full code is:
from selenium import webdriver
from selenium.webdriver....
0
votes
1
answer
180
views
How do we print a function's name along with the calling arguments?
We want to print each function call along with the calling arguments.
Consider the following recursive function decorated with a user-defined (custom-made) decorator named @traced:
@traced
def foo(a,b)...
1
vote
1
answer
327
views
How can I print functions as they are being called?
I am new in a large complicated codebase. I would like to follow a request as it is being processed. For this I'd like to have a feature that enables printing each function that is being called ...
5
votes
1
answer
2k
views
Stop ChromeDriver backtrace logs when Selenium tests fail
I have issue with to verbose logging by ChromeDriver
When selenium test fail, beside standard error logs in terminal I get backtrace messages like:
Stacktrace:
Backtrace:
Ordinal0 [0x00B378B3+...
1
vote
2
answers
523
views
How can I jump into my code in pdb in python rather than library code?
I'm writing some code; to do this I am letting my code fail and using python -m pdb to inspect what's going on. But when I do so the code starts a few layers down in library code and then I have to go ...
1
vote
0
answers
503
views
How to get the call stack of a Python library's function?
I need to understand the code base of a relatively big Python library. The code being too convoluted, I thought it would be a good start to know which methods call which other methods when I execute ...
2
votes
0
answers
259
views
How to check if frame object is active
import sys
frame = sys._getframe()
How can I check now whether frame (of type FrameType) is still active (part of the current execution stack trace)?
I could iterate through the current stack trace (...
2
votes
1
answer
176
views
weakref (WeakKeyDictionary) to frame (FrameType) objects
I want to have a dict mapping from active frame (FrameType) objects to some data. Active meaning that it is in the current execution stack trace.
However, holding a reference to the frame object is ...
6
votes
0
answers
2k
views
How can I make Loguru log full backtrace to a file?
Please excuse if I'm doing something wrong, this is my first question here.
this is my configuration:
def logging_module():
"""A customized Loguru logging module"""
...
0
votes
2
answers
405
views
Hi can someone explain what this error means and what i can do to prevent this button?
Background
I encountered this error when I'm trying to click a button. However, the webpage would show that I am unable to press this submit button, then it will give me this error and stop running ...
1
vote
2
answers
9k
views
What does Backtrace: Ordinal0 [0x00723AB3+2505395] in stack trace error means while using Selenium and ChromeDriver
I'm relatively new to coding and kinda unfamiliar with stacktrace errors.
I have been given this error, but im not sure which part of my code do i fix? Did the error come
up because of a ...
0
votes
0
answers
161
views
Correct method of getting frame input parameter for traceback.print_stack()
I'm trying to use traceback.print_stack() to print the stack leading up to the error without including the line which actually prints the stack. e.g.:
import os
import pathlib
import sys
import ...
0
votes
2
answers
327
views
Cleaning up interal path and stack levels in CustomException messages raised
Since we are raising, not excepting the CustomException, I have to
learn for new stuff on handing a stacktrace that exists not as a
raised except but as the exception that will be raised, if that ...
3
votes
1
answer
5k
views
Python - How to print stack trace at all log levels and even outside exceptions?
My codebase is extremely large, and we’d like to print the stack for all logs.
This includes logs at all levels (even INFO and DEBUG).
This also includes logs outside of an exception happening.
Things ...
-3
votes
2
answers
209
views
How to prevent a recursion error implementing factorial in Python
I'm developing a math suite and am currently having issues implementing the recursive version of the factorial function. The issue is when I use it in my Bayesian combination function:
C(n,k) = n! / k!...
1
vote
2
answers
169
views
Why does using list comprehension affect the stack trace?
I was playing around with inspect module, and noticed that the stack has an extra layer when I use list comprehension.
Here's a basic example. I expected both print function calls to give the same ...
2
votes
1
answer
354
views
Passing exception stack traces from C++ to Python (via Cython)
Problem
I have a logging and infra system which I can't (and don't want to modify), in Python, that relies on the Tracebacks of the exceptions.
I have C++ code wrapped with Cython. This C++ code can ...
1
vote
0
answers
76
views
How to extract method call information from .trace file?
I have pulled .trace file using adb and viewed in Android studio profiler option. But I need to extract the method calls using python or any language. How could I do it?
1
vote
1
answer
399
views
How to annotate lines with code when running PyRun_String() in Python C API?
I'm using PyRun_String() from Python C API to run python code.
Passing Py_file_input for start and for globals and locals I pass dictionary created with PyDict_New(), and for string of code str I pass ...
0
votes
1
answer
445
views
In Python, how can the traceback module be used to find where an exception is generated?
I'm working on a convoluted FOSS project that utilizes GTK+3. When a flow graph is generated and attempted to run it, it generates the following error:
'Page' object has no attribute 'get_flow_graph'
...
3
votes
1
answer
851
views
Trace specific functions in Python to capture high-level execution flow
Python offers tracing through its trace module. There are also custom solutions like this. But these approaches capture most low-level executions, inside-and-out of most/every library you use. Other ...
0
votes
1
answer
153
views
How to build an exception that points to a saved python traceback?
I'm trying to do something a little weird. I want to save a stack trace in Python, and then when I throw an exception on some later line, I want that exception to have the stack trace that I saved ...
0
votes
1
answer
464
views
pysimplegui print stack trace to console
I'm trying my hand at pysimplegui to build my first UI. However, I keep getting an error but in a flash a stack trace appears before the screen, the program ends and unable to read it. Is there anyway ...
0
votes
0
answers
287
views
Printing full stack trace from invocation root when try/catching exception in Python?
How can one log the entire stack trace when logging a caught exception, just like it would if the exception wasn't caught?
Currently it only includes stack up until the try/catch block, but not ...
0
votes
1
answer
202
views
trace python's call stack address
To track the complete calling history , a.k.a , the sequence of
' F_BACK '
Here's my code:
import sys
def trace_calls(frame, event, arg):
if event != 'call':
return
co = frame....
5
votes
1
answer
356
views
Orphan stacktraces in sys._current_frames()
Here's an esoteric pure-Python question.
I'm doing some statistical profiling using sys._current_frames(). i.e. I've got a background thread that runs sys._current_frames() once every second, dumps ...
6
votes
2
answers
2k
views
Print argument values to functions in stack trace
How can we print the values of arguments passed to the functions in the call stack when an error stack trace is printed? I would like the output to be exactly as in the example below.
Example:
...
2
votes
0
answers
147
views
Python - (better text editor integration) changing the default stacktrace format displayed in the terminal
Let's take a typical stacktrace running Python on the command line:
Traceback (most recent call last):
File "load_mvprd.py", line 654, in <module>
run()
File "/myapp/venv/lib/python3.6/...
2
votes
1
answer
989
views
How to check if the return value of a function is assigned to anything in Python
I have a function that has a return value. I'd like the function to behave differently when the return value of the function is assigned to something.
So something like this:
def func():
if ...
3
votes
1
answer
789
views
Show the original function when logging funcName in a decorator
I have a decorator to retry some operations for 3 times if a deadlock happens, and does some logging in the process:
def retry_on_deadlock(func):
logger = logging.getLogger('test')
@wraps(...
2
votes
1
answer
104
views
python - log the request's journey
I want to log all methods a single request has visited once at the end of the request for debugging purposes.
I'm ok with starting with just one class at first:
here is my desired output example:
...
0
votes
1
answer
64
views
statcktrace of classmethod not getting printed in python
There is a @classmethod in a class which is being called automatically when class is imported. I want to know the parameters being passed to that method. So I deliberately added a code to crash that ...
0
votes
0
answers
31
views
Is it possible to programmatically search Python's middle scopes? [duplicate]
Consider the Python code where function1 has x defined in its local scope. I am wondering if it is possible to write go_up_stack_and_find("x") so that it will go up the stack, through the middle ...
2
votes
2
answers
366
views
identifying which function call is currently executing
When having multiple call of the same function on the same line. Is it possible for troubleshooting purpose, to use the traceback or the sys library to identify which one is currently executing ?
...
0
votes
2
answers
51
views
get the taken path until a line in python
Given a python function with nested if-else statements, how can we get the path we have taken to arrive to a line.
def function():
if condition1:
if condition2:
sth
else:
...
1
vote
0
answers
658
views
How to correctly override TestCase.assertEqual(), producing the right stacktrace?
I am trying to implement a clean answer for Continuing in Python's unittest when an assertion fails.
I would like the improve the most voted and non-accepted answer: https://stackoverflow.com/a/...