Root and argparse Python module

Hi,

I am using ROOT 6.04/14 in OSX 10.11.5. I attached a minimal (its really short) example of the problem I have with my code.

When I do:

./run.py -h

The Base.py module gets loaded, which imports (and therefore runs) Tools.py, which uses ROOT to make a histogram. Then I use the argparse module. If I comment the line that imports Tools.py and write it down, after pars_args is called I get the right output. If I import this module at the beginning, before pars_args is called I get the help for root.exe and the computer claims that the executable is not run.py but /usr/bin/python.

I can bypass this easily by importing Tools.py after I call pars_args but I thought I should let you know this in case someone else gets this type of problem. Also, is there a more elegant way to bypass this?

Cheers.
run.py (31 Bytes)
Tools.py (63 Bytes)
Base.py (281 Bytes)

Hi,

see this interesting post about the behaviour you are describing: PyROOT hijacks --help

Danilo

Hi,

That totally makes sense.

Thanks.