Python crashes when using and gROOT->SetStyle

Hello. I hope someone can point out why I’m getting an error with the following, it seems to simple…

I have a ~/.rootlogon.C with:

{ cout << endl << "Welcome to ./.rootlogon.C" << endl; gROOT->SetStyle("Plain"); }

and/or a ~/ with:

import ROOT print "Welcome to your ./" ROOT.gROOT.SetStyle("Plain")

When I run python code with defined as above, I error like the following:

[code]mwoods 12:13:48 ~$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
x = ROOT.Long()
Welcome to your ./
Traceback (most recent call last):
File “”, line 1, in
File “lib/”, line 396, in __getattr1
File “lib/”, line 479, in __finalSetup
imp.load_module( ‘rootlogon’, open( rootlogon, ‘r’ ), rootlogon, (’.py’,‘r’,1) )
File “/Users/mwoods/”, line 3, in
File “lib/”, line 344, in getattr
File “lib/”, line 447, in __finalSetup
self.class.getattr = self.class.__getattr2
AttributeError: type object ‘ModuleFacade’ has no attribute ‘_ModuleFacade__getattr2’


If I remove then .rootlogon.C runs just fine (I see the cout and the style is changed). It is the SetStyle method that is causing problems, but I can’t figure out why. Any ideas? Thanks.


not so much SetStyle(), but just that gROOT is initially a special case so that SetBatch() can be called on it before the TApplication is created (and hence pre-empting any graphics initialization). The __finalSetup() is calling, but at that point gROOT is still the wrapper, so __finalSetup() is called again from within

Now fixed in trunk.

As a workaround, do:ROOT.module._root.gROOT.SetStyle("Plain")which will bypass the gROOT wrapper.


Thanks Wim. Worked like a charm.