On Nov 28, 2007, at 12:51 PM, Danilo.Piparo_at_mib.infn.it wrote:
> Hello,
> using ROOT 5.14.00g and the python bindings I have this script:
>
> myscript.py:
>
> import os
>
> print 'Let\'s Rock'
> from ROOT import gROOT
>
> os.system('pwd')
>
> if I do:
> mkdir mydir
> python myscript.py mydir
This is a "feature" of TApplication, which PyROOT has to instantiate behind the scenes for you when you import it. You'll find that the root application itself also has this behavior.
The workaround I use is to either hack TApplication to stop doing this, or to bracket all "import ROOT" type entries with this code:
import sys
_argv = sys.argv
sys.argv = sys.argv[:1]
from ROOT import TFile, TNtuple
sys.argv = _argv
A general question for the ROOT devs: Why was this auto-chdir added to TApplication in the first place? Does anyone rely on this behavior in the normal root application?
--- Stan SeibertReceived on Wed Nov 28 2007 - 20:14:53 CET
This archive was generated by hypermail 2.2.0 : Thu Nov 29 2007 - 05:50:02 CET