# PyROOT hijacks --help

**URL:** <https://root-forum.cern.ch/t/pyroot-hijacks-help/15207>\
**Category:** ROOT\
**Created:** [November 7, 2012, 2:00pm UTC](https://root-forum.cern.ch/t/pyroot-hijacks-help/15207 "2012-11-07T14:00:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geert-Jan](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/e19b73/32.png) [@Geert-Jan](https://root-forum.cern.ch/u/Geert-Jan)\
**Post date:** [November 7, 2012, 2:00pm UTC](https://root-forum.cern.ch/t/pyroot-hijacks-help/15207/1 "2012-11-07T14:00:02Z")

</div>

Hi,

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/HistFitter.py -h  
Usage: python [-l] [-b] [-n] [-q] [dir] [[file:]data.root] [file1.C … fileN.C]  
Options:  
-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

[/code]

Also I see stuff like

`gbesjes@groesbeek:~/work/HistFitter $ ./scripts/HistFitter.py -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

[code]  
gbesjes@groesbeek:~/work/HistFitter $ cat scripts/HistFitter.py  
#!/usr/bin/env python  
from ROOT import gROOT,gSystem,gDirectory,RooAbsData,RooRandom,RooWorkspace  
gSystem.Load(“[libSusyFitter.so](http://libSusyFitter.so)”)  
from ROOT import ConfigMgr  
gROOT.Reset()  
import sys

[…]

if **name** == “ **main** ”:  
sys.exit()[/code]  
(ConfigMgr is a C++ class that we wrote and exposed.)

Regards,  
Geert-Jan

---

<div class="post-metadata">

**Author:** ![wlav](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/w/f07891/32.png) [@wlav](https://root-forum.cern.ch/u/wlav)\
**Post date:** [November 7, 2012, 6:24pm UTC](https://root-forum.cern.ch/t/pyroot-hijacks-help/15207/2 "2012-11-07T18:24:09Z")

</div>

Hi,

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 = True`to pre-empt that behavior, or adjust sys.argv in detail for perusal by both your script and TApplication.

Cheers,  
Wim
