Turn of messages using TError

Hi everybody,

I would like to turn of printing messages in my python/root routines using the global variable gErrorIgnoreLevel as it is described in:

http://root.cern.ch/phpBB2/viewtopic.php?t=78

However, I’m not sure how to do that. Apparentely, there is no TError member of the ROOT module and the above variable is not part of gROOT.

Any hint would be greatly appreciated.

Cheers,

         Riko

Riko,

[sorry for not replying earlier, but I was travelling and had no net access]

which version of ROOT are you using? The following works fine for me (HEAD CVS; 5.11/02):[code]

import ROOT
c = ROOT.TCanvas()
c.Print( “aap.eps” )
Info in : eps file aap.eps has been created
c.Print( “aap.eps” )
Info in : eps file aap.eps has been created
ROOT.gErrorIgnoreLevel = 1
c.Print( “aap.eps” )
[/code]

Cheers,
Wim

Hi Wim,

thanks for answering. I’m using root 5.10/00 and there it does not seem to work:

[code]>>> import ROOT

ROOT.gErrorIgnoreLevel = 1
c1 = ROOT.TCanvas()
c1.Print(“c1.eps”)
Info in : eps file c1.eps has been created
ROOT.gErrorIgnoreLevel = 1
c1.Print(“c1.eps”)
Info in : eps file c1.eps has been created
[/code]

I just saw, that even though 5.10 is the current pro-version of root, it is not the recommended one anymore … maybe, I give 5.11/06 a try …

Cheers,

          Riko

ok, in 5.11/06 setting gErrorIgnoreLevel works as advertised :slight_smile:

However, when I’m running root from Python, I usually just import the modules I need, so instead of doing

import ROOT
I do for example:

from ROOT import TCanvas

Maybe, this is actually more of a python question and not a root question, but why doesn’t this work?

[code]>>> from ROOT import TCanvas

from ROOT import gErrorIgnoreLevel
print gErrorIgnoreLevel
-1
gErrorIgnoreLevel = 1
print gErrorIgnoreLevel
1
c1 = TCanvas()
c1.Print(‘c1.eps’)
Info in : eps file c1.eps has been created
[/code]

Thanks and Cheers,

              Riko

Riko,

all variables in python are references, so after a “from ROOT import gErrorIgnoreLevel”, all you have is a reference to that variable. If you then assign a new value to that reference, the reference is changed to point to that new value and no longer has any relation to the old one. The old value is never touched in the process. Compare:[code]>>> from ROOT import TCanvas

TCanvas = 1
print TCanvas
1
[/code]
In the case of direct access “ROOT.gErrorIgnoreLevel”, you make the reference inside that module point to the new value. Normally, speaking strictly python, the module then “knows” about the new value b/c it is using that reference. But then in order for the C++ side to pick up the value also, it still needs transporting. I’m not quite sure when that code was written, but apparently only recently.

Worst case, you can always rely on "gROOT.ProcessLine( "gErrorIgnoreLevel = 1; " ).

Cheers,
Wim

Hi Wim,

thanks for clarifying that for me!

Cheers,

                Riko