PyROOT hijacks --help


PyROOT hijacks my --help option. I’m doing nothing except importing argparse, adding an option and then trying to print it. Executing -h gives me PyROOT’s help message. I’ve testing this by importing a .so file and immedialy having main exit. Even then this is the effect:

[code]gbesjes@groesbeek:~/work/HistFitter $ ./scripts/ -h
Usage: python [-l] [-b] [-n] [-q] [dir] [[file:]data.root] [file1.C … fileN.C]
-b : run in batch mode without graphics
-x : exit on exception
-n : do not execute logon and logoff macros as specified in .rootrc
-q : exit after processing command line macro files
-l : do not show splash screen
dir : if dir is a valid directory cd to it before executing

-? : print usage
-h : print usage
–help : print usage
-config : print ./configure options
-memstat : run with memory usage monitoring


Also I see stuff like

gbesjes@groesbeek:~/work/HistFitter $ ./scripts/ -config ROOT ./configure options: QTDIR=/usr/lib64/qt-3.3 --all

How can I prevent this behaviour? I’m not at all interested in PyROOT’s help messages, but want to display useful stuff to users.

Again, all that I do is

gbesjes@groesbeek:~/work/HistFitter $ cat scripts/
#!/usr/bin/env python
from ROOT import gROOT,gSystem,gDirectory,RooAbsData,RooRandom,RooWorkspace
from ROOT import ConfigMgr
import sys


if name == “main”:
(ConfigMgr is a C++ class that we wrote and exposed.)


1 Like


the full sys.argv is handed to TApplication, which expects it. That’s where the help message comes from. You can use:import ROOT ROOT.PyConfig.IgnoreCommandLineOptions = Trueto pre-empt that behavior, or adjust sys.argv in detail for perusal by both your script and TApplication.