behavior of KeyboardInterrupt?
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 38/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Bereich
- data-visualization, desktop
Rechercherichtung
Reproduziere das Windows-Ctrl-C-Verhalten mit PythonPlot, der im Issue gezeigten while true-Schleife und dem dort gezeigten Plot-Aufruf. Beginne bei src/pygui.jl:199 und untersuche den PythonCall- und tkinter-Timer-Stack; vergleiche das Ergebnis mit dem GR-Backend. Erledigt ist die Aufgabe, wenn die Julia-Berechnung unterbrochen werden kann, ohne nachfolgende PythonPlot-Aufrufe zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
During an interactive session where I am variously running computations and plotting things, when I try to keyboard interrupt a running computation, Python apparently gets interrupted instead; for example, notice what happens when I hit Ctrl-C during a while true block:
julia> using PythonPlot
julia> plot(range(0, 1, 101).^2)
Python: [<matplotlib.lines.Line2D object at 0x0000022445A5FF50>]
julia> while true # surrogate for some long computation that I decide I want to interrupt
5+2
sleep(0.1)
end
Error in Timer:
Python: KeyboardInterrupt:
Python stacktrace:
[1] __getattr__
@ tkinter C:\Users\zor_q\.julia\environments\v1.9\.CondaPkg\env\Lib\tkinter\__init__.py:2408
Stacktrace:
[1] pythrow()
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\err.jl:94
[2] errcheck
@ C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\err.jl:10 [inlined]
[3] pygetattr(x::PythonCall.Py, k::String)
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\abstract\object.jl:60
[4] getproperty(x::PythonCall.Py, k::Symbol)
@ PythonCall C:\Users\zor_q\.julia\packages\PythonCall\qTEA1\src\Py.jl:261
[5] (::PythonPlot.var"#9#10"{PythonCall.Py, PythonCall.Py, PythonCall.Py})(async::Timer)
@ PythonPlot C:\Users\zor_q\.julia\packages\PythonPlot\f591M\src\pygui.jl:199
[6] macro expansion
@ .\asyncevent.jl:281 [inlined]
[7] (::Base.var"#702#703"{PythonPlot.var"#9#10"{PythonCall.Py, PythonCall.Py, PythonCall.Py}, Timer})()
@ Base .\task.jl:134
Meanwhile, the while true block continues running. If it were a computation that came to an end at some point, all future plotting would fail (I assume because the background Python process is no longer running?).
Is this the expected behavior? I would have hoped that the execution of the while true block would have been interrupted and Python would have been left alone.
For comparison, when using GR, it's the while true block that gets interrupted:
julia> using Plots # default backend is GR
julia> plot(range(0, 1, 101).^2) # plot window pops up
julia> while true # surrogate for long computation that I decide I want to interrupt
5+2
sleep(0.1)
end
ERROR: InterruptException:
Stacktrace:
[1] poptask(W::Base.IntrusiveLinkedListSynchronized{Task})
@ Base .\task.jl:974
[2] wait()
@ Base .\task.jl:983
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock}; first::Bool)
@ Base .\condition.jl:130
[4] wait
@ .\condition.jl:125 [inlined]
[5] _trywait(t::Timer)
@ Base .\asyncevent.jl:138
[6] wait
@ .\asyncevent.jl:155 [inlined]
[7] sleep
@ .\asyncevent.jl:240 [inlined]
[8] top-level scope
@ .\REPL[3]:3
julia> plot(range(0, 1, 101).^2) # still plots successfully
julia> backend()
Plots.GRBackend()
- Vorherrschende Sprache
- Julia
- Sterne
- 85
- Forks
- 9
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus JuliaPy/PythonPlot.jl
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
JuliaPy/PythonPlot.jl#55 · 3 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
JuliaPy/PythonPlot.jl#54 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
JuliaPy/PythonPlot.jl#53 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 35/100
JuliaPy/PythonPlot.jl#52 · 2 Reaktionen ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 20/100
JuliaPy/PythonPlot.jl#51 ·
Alle Issues in JuliaPy/PythonPlot.jl
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
SciML/Optimization.jl#1414 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
SciML/OrdinaryDiffEq.jl#4831 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
SciML/ModelingToolkitStandardLibrary.jl#529 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 60/100
EnzymeAD/ReactantServer.jl#103 ·
Maintainer antworten meist innerhalb von 1 Tag