All Questions
54 questions
-2
votes
0
answers
37
views
Can I get the Python interpreter to print stack traces with one line per frame rather than two?
When an exception is raised in Python, we get something like:
Location
source line
Location
source line
Location
source line
yet - I would rather have one line per "stack frame", e.g.:...
0
votes
1
answer
58
views
How do I properly handle exceptions in Python without losing the traceback information?
I'm working on a Python application where I need to gracefully handle exceptions and log useful information for debugging purposes. Specifically, I want to catch exceptions that occur during runtime, ...
2
votes
0
answers
169
views
Force breaking from a loop in Pycharm debugger
I would like to know if it is possible to break from a loop using the Pycharm debugger (python). I am debugging machine learning code and sometimes I would prefer to avoid executing entirely the long ...
-3
votes
1
answer
526
views
python script error : Local variable referenced before assignment
we wrote a python test script to automate a few tasks including adding service accounts and resource groups . At execution I get an error message :
'UnboundLocalError: local variable 'sa_clientId' ...
2
votes
1
answer
228
views
How do you find out which ParserElements are matching strings in Pyparsing?
I have a complex of sub-ParserElements anded together like so, and I plan on adding more.
Group(multi_line ^ macro_parser ^ numeric_assignment ^ assert_parser ^ db ^
...
1
vote
0
answers
67
views
Debugging python code: Determine if an 'except' is waiting for an exception in some later frame
When executing a python script while having installed a trace callback via sys.set_trace (), I would like to be able to distinguish between exceptions which will later be excepted in the python code ...
0
votes
0
answers
199
views
Enter Python debugger on an exception ignored by a library
I have introduced a bug in some complicated code which is noisily swallowed by some library code I don't want to learn about:
In [212]: start = time() ; result = big_messy_thing() ; stop = time() ; ...
5
votes
2
answers
1k
views
Capture PyCharm stop signal in Python
I want to try capturing PyCharm's stop signal (when stop is pressed) in a try block, but I cannot figure out what this signal is or how to capture it in code. JetBrains doesn't provide insight into ...
1
vote
1
answer
55
views
Issue with iteratively writing text files with try-except
The following is my code -
for file in files:
k+=1
f = str(file)
with open(f) as data:
post = json.load(data)
l+=1
try:
query = post["title"]+" - ...
0
votes
1
answer
288
views
How to debug Python script with IPython --pdb?
I would like to debug an extension written for Sphinx in interactive mode using pdb which work great for simple scripts. When I execute sphinx-build -M html . _build I get an ValueError. So to debug ...
0
votes
0
answers
261
views
How do I debug a free() error in Python 3?
I have a Python3 program (https://github.com/HowardALandman/QTD/blob/master/src/qtd.py) that has been running fine under Raspbian Buster or Stretch, EXCEPT that occasionally (maybe once per day of ...
10
votes
1
answer
2k
views
Pycharm - Break on Any Exception but ignore StopIteration and ExitGenerator
In Pycharm I would like to, in debug mode, stop on any exception that enters my code but ignore any exceptions that are thrown and caught by library functions.
Pycharm has an option in breakpoints ...
0
votes
1
answer
91
views
Try/except not working as expected: "Except" error message is appended to passing result
I have code that is meant to find a graph on a webpage and create a link for web-crawling from it. If a graph is not found, then I've put in a try/except to print a message with a corresponding (...
1
vote
2
answers
3k
views
How Do I Get Pycharm to Break on Exceptions
I'm using PyCharm for debugging. One of the big headaches that I keep having is that even in debug mode, the IDE exits on an exception instead of breaking. There are already questions about this issue ...
14
votes
2
answers
1k
views
How do I check if current code is part of a try-except-block?
I'm debugging a function that I wrote as part of some form of plug-in framework. The function does not appear to be doing what it should, and I have the suspicion that, somewhere up the stack, ...