Pyroot hangs depending on command line options

I find that when I execute

python2.6 my_macro --my_option “/my/file/name”

python will hang at this point in my macro

depending on whether

hangs when executed on the command line.

–my_option is something I define in my macro using the OptionParser, so why would from ROOT import * have any behavior that depends on which command line options I use?

I see there was a similar thread here:

I will clean sys.argv after parsing the options.


the application should not hang, but the file (if it exists) does get handed to TApplication, so it will have an effect.

Beyond telling ROOT to ignore the command line options, an alternative is to separate the argument list with a standalone ‘-’ or ‘–’ argument. Have the python and ROOT options before this and the arguments for the script after.