Pyroot in batch mode?

Hi,

Is there a way to make pyroot come up in batch mode, like root -b with CINT? I tried ROOT.gROOT.SetBatch(True) but that does not really work (neither does this work in CINT).

Thank you,

Martin Kocian

Hi Martin,

yes, add ‘-b’ on the command line. Either by:$ python <somescript>.py -bwhen running a script, or by $ python - -bwhen running interactively, or by putting ‘-b’ directly into sys.argv before loading PyROOT:import sys sys.argv.append( '-b-' ) import ROOTwhen loading the code as a module only.

The ‘-b’ is in all cases forwarded to the TApplication which will then take care of it properly; internally, PyROOT will not start the GUI thread (which can be terminated as well be setting ROOT.keeppolling to 0, but be careful not to do that while you’re having any canvases open).

HTH,
Wim