def f(x) :
x / x
def g(x) :
try :
f(x)
except Exception as e :
assert 0
g(0)
< /code>
Wenn ich das Programm mit Python3 -m PDB A.Py < /code> ausführe, wird das Programm unter Assert 0 < /code> Zeile beendet, und ich erhalte die folgenden Fehlerinformationen: < /p>
Traceback (most recent call last):
File "/tmp/a.py", line 6, in g
f(x)
File "/tmp/a.py", line 2, in f
x / x
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib64/python3.6/pdb.py", line 1667, in main
pdb._runscript(mainpyfile)
File "/usr/lib64/python3.6/pdb.py", line 1548, in _runscript
self.run(statement)
File "/usr/lib64/python3.6/bdb.py", line 434, in run
exec(cmd, globals, locals)
File "", line 1, in
File "/tmp/a.py", line 11, in
g(0)
File "/tmp/a.py", line 9, in g
assert 0
AssertionError
< /code>
und der Stapel wird (mit BT < /code> Befehl angezeigt): < /p>
gezeigt(Pdb) bt
/usr/lib64/python3.6/pdb.py(1667)main()
-> pdb._runscript(mainpyfile)
/usr/lib64/python3.6/pdb.py(1548)_runscript()
-> self.run(statement)
/usr/lib64/python3.6/bdb.py(434)run()
-> exec(cmd, globals, locals)
(1)()->None
/tmp/a.py(11)()->None
-> g(0)
> /tmp/a.py(9)g()
-> assert 0
(Pdb)
Das Problem ist, dass ich nicht zu Funktion F zum Debuggen von x/x einfach up und down gehen kann, da mein Stapel an der G -Funktion endet. < /p>
Wie soll ich solche Ausnahmen innerhalb von Ausnahmen debuggen? Was ist mit Ausnahmen innerhalb von Ausnahmen innerhalb von Ausnahmen ...?
Ich debuggiere ein Programm namens A.Py < /code> mit PDB < /p>
[code]def f(x) : x / x
def g(x) : try : f(x) except Exception as e : assert 0
g(0) < /code>
Wenn ich das Programm mit Python3 -m PDB A.Py < /code> ausführe, wird das Programm unter Assert 0 < /code> Zeile beendet, und ich erhalte die folgenden Fehlerinformationen: < /p>
Traceback (most recent call last): File "/tmp/a.py", line 6, in g f(x) File "/tmp/a.py", line 2, in f x / x ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib64/python3.6/pdb.py", line 1667, in main pdb._runscript(mainpyfile) File "/usr/lib64/python3.6/pdb.py", line 1548, in _runscript self.run(statement) File "/usr/lib64/python3.6/bdb.py", line 434, in run exec(cmd, globals, locals) File "", line 1, in File "/tmp/a.py", line 11, in g(0) File "/tmp/a.py", line 9, in g assert 0 AssertionError < /code>
und der Stapel wird (mit BT < /code> Befehl angezeigt): < /p>
Das [url=viewtopic.php?t=20324]Problem[/url] ist, dass ich nicht zu Funktion F zum Debuggen von x/x einfach up und down gehen kann, da mein Stapel an der G -Funktion endet. < /p>
Wie soll ich solche Ausnahmen innerhalb von Ausnahmen debuggen? Was ist mit Ausnahmen innerhalb von Ausnahmen innerhalb von Ausnahmen ...?
Ich möchte IPDB anstelle von PDB mit Py.test -PDB -Option verwenden. Ist das möglich? Wenn ja, wie? ipdb.set_trace () im Code, aber das erfordert, dass der Test fehlschlägt, eine Datei öffnen, den...
Ich versuche, eine Figur in Python mit Matplotlib.pyplot zu erstellen, das 3 Nebenhandlungen in einer Reihe enthält. Aber ich habe jedoch Schwierigkeiten mit den Frames, die ursprünglich durch meinen...
Alle für dieses Problem verfügbaren Antworten sind Lösungen für Visual Studio. Ich stehe vor diesem Problem in QT. Ich führe ein Beispielbeispiel aus, aber dieser Fehler erscheint. Könnte jemand...
Wie tötest du PDB und das Programm, das es läuft, ähnlich wie LLDBs Proc Kill? Beenden Sie oder beenden (y) Befehle? T funktioniert und alle Fragen, die ich hier sehe, ist, wie man beendet, während...