Hello everyone!
I am encountering a strange error with pyroot.
I am using an opt-parser in my python script to read in some parameters (see attached minimal working example MWE.py), which also defines a -h|–help option and others, like -b. Additionally I am including some ROOT classes, e.g. TH1F
import ROOT
from ROOT import TH1F
If I call the script with the -b option, it fulfills the desired behaviour
$python MWE.py -b
INFO :: Triggered parameter -b
But if I use the -h paramter to trigger the help for the script, I get the help output from pyroot
[code]$python MWE.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]
If I uncomment the import of TH1F, the script again runs as it should
$python MWE.py -h
INFO :: Triggered parameter -h
I am using
[code]$which root
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/5.34.10-x86_64-slc6-gcc4.7/bin/root
$which python
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/python/2.7.3-x86_64-slc6-gcc47/sw/lcg/external/Python/2.7.3/x86_64-slc6-gcc47-opt/bin/python[/code]
MWE.py (697 Bytes)