root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.6k stars 1.25k forks source link

[PyROOT, Graphics] Cannot pause pyROOT script with `input()` and see canvases #13744

Open dpiparo opened 10 months ago

dpiparo commented 10 months ago

Check duplicate issues.

Description

This script used to work, also on MacOS

import ROOT

h = ROOT.TH1F("foo", "bar", 64, -4, 4)
h.FillRandom("gaus")
c=ROOT.TCanvas()
h.Draw()
c.Update()

input()

and allowed to see and interact with the canvas to then end execution upon pressing a key. This results now in a deadlock in master.

Reproducer

import ROOT

h = ROOT.TH1F("foo", "bar", 64, -4, 4)
h.FillRandom("gaus")
c=ROOT.TCanvas()
h.Draw()
c.Update()

input()

ROOT version

master

Installation method

built from sources

Operating system

MacOS

Additional context

No response

linev commented 10 months ago

I can reproduce problem with input() also on my Linux, And I see that MacOS handled differently. I will provide PR soon to see if small changes could help

dpiparo commented 10 months ago

Reopened b/c of this https://github.com/root-project/root/pull/13754

linev commented 10 months ago

Seems to be it is not possible to run extra thread in python on Mac in script mode. At the same time input hook is also not working in script mode. Thus canvas - even shown - remains fully frozen. It is exactly a situation as was in previous ROOT releases.

In web case this leads just to empty web browser. Probably I can improve this

Axel-Naumann commented 9 months ago

Do I understand correctly that this is an old (i.e. <v6.28) issue? Can we then fix it in a patch release of 6.30 rather than blocking 6.30/00 for it?

dpiparo commented 9 months ago

Yes, we can, and in my opinion, should.