Ctrl-c: matplotlib can capture the SIGINT of the BLISS session
Feedback from @muzelle and @felix
def plot():
import matplotlib.pyplot as plt
x =[1,2,3,4,5,6,7,8,9,10]
plt.plot(x, c='red', marker="o")
pause = plt.pause(0.1)
g = gevent.spawn(pause)
while True:
try:
g.get()
except KeyboardInterrupt:
plt.close("all")
break
def sleep():
while True:
print(f"Waiting {3} seconds...")
sleep(3)
What we saw is the problem when matplotlib is used with the Qt backend (the default in our env), it capture the SIGINT. As result we don't have anymore access to it from the BLISS shell.
For example nabu
is used in tomo beamlines to display statistics with matplotlib.
But any users at a beamline could use matplotlib.
The tk backend could be setup instead to prevent the problem. Or we could ask people to use Flint instead.
That's something we could do in bliss, but at the same time it's not really our responsability.
import matplotlib
matplotlib.use("tkagg")
How should we handle that problem?