# Root and argparse Python module

**URL:** <https://root-forum.cern.ch/t/root-and-argparse-python-module/21372>\
**Category:** ROOT\
**Created:** [June 17, 2016, 7:45pm UTC](https://root-forum.cern.ch/t/root-and-argparse-python-module/21372 "2016-06-17T19:45:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooter\_03](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rooter_03/32/19119_2.png) [@rooter\_03](https://root-forum.cern.ch/u/rooter_03)\
**Post date:** [June 17, 2016, 7:45pm UTC](https://root-forum.cern.ch/t/root-and-argparse-python-module/21372/1 "2016-06-17T19:45:44Z")

</div>

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:

```auto
./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](https://root-forum.cern.ch/uploads/default/original/2X/7/769e6ebb91e2f98fe863deefe01589e04e963df3.py) (31 Bytes)  
[Tools.py](https://root-forum.cern.ch/uploads/default/original/2X/4/4911310cee05d31aa42293b7afd46816cfb582e7.py) (63 Bytes)  
[Base.py](https://root-forum.cern.ch/uploads/default/original/2X/b/b502d7c0282065b54e35777fe29d5cd1438e5b2b.py) (281 Bytes)

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [June 17, 2016, 8:03pm UTC](https://root-forum.cern.ch/t/root-and-argparse-python-module/21372/2 "2016-06-17T20:03:36Z")

</div>

Hi,

see this interesting post about the behaviour you are describing: [PyROOT hijacks --help](https://root-forum.cern.ch/t/pyroot-hijacks-help/15207/1)

Danilo

---

<div class="post-metadata">

**Author:** ![rooter\_03](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/rooter_03/32/19119_2.png) [@rooter\_03](https://root-forum.cern.ch/u/rooter_03)\
**Post date:** [June 18, 2016, 9:04am UTC](https://root-forum.cern.ch/t/root-and-argparse-python-module/21372/3 "2016-06-18T09:04:45Z")

</div>

Hi,

That totally makes sense.

Thanks.
