If for some reason you have to use PyROOT (in my case, I need to use
TMVA), you probably still
want to parse command line arguments for yourself, e.g. with
optparse. To prevent PyROOT from scooping up the command
line, import it like so:
import sys
tmpargv = sys.argv[:] # [:] for a copy, not reference
sys.argv = []
from ROOT import gSystem, gROOT
from ROOT import TMVA # otherwise I wouldn't be using ROOT!
sys.argv = tmpargv
from optparse import OptionParser
Et voilá, your command line is under control!
import ROOT
ReplyDeleteROOT.PyConfig.IgnoreCommandLineOptions = True
Thanks, Ruggero! Luckily I'm not using ROOT at all anymore. :)
ReplyDelete