Hi, I found a very confusing error(for me) when running pyroot with Spyder.
For example I am able to run:
import ROOT
TwoDGaus=ROOT.TF2("TwoDGaus","([0]*TMath::Gaus(x,[1],[2]))")
TwoDGaus.SetParameter(0,5)
TwoDGaus.SetParameter(1,25)
TwoDGaus.SetParameter(2,1)
h_gaus = ROOT.TH1D("h_gaus", "", 20,-5, 5)
h_gaus.Reset()
h_gaus.FillRandom('gaus',10000)
h_gaus.Draw()
Without problems the first time. But if I try to re-run the script I run in to a error:
runfile('/home/fredrik/Code_python/Gaustest.py', wdir='/home/fredrik/Code_python')
Traceback (most recent call last):
File "<ipython-input-2-380ebd19039d>", line 1, in <module>
runfile('/home/fredrik/Code_python/Gaustest.py', wdir='/home/fredrik/Code_python')
File "/home/fredrik/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 681, in runfile
__umr__.run(verbose=verbose)
File "/home/fredrik/anaconda2/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 628, in run
modpath = getattr(module, '__file__', None)
File "/home/fredrik/root/lib/ROOT.py", line 215, in __getattr__
klass = _root.MakeRootClass( attr, cls )
TypeError: requested class 'ROOT::__file__' does not exist
And I have to restart the kernel in order to get it working again for one run then error occurs again.
I am pretty clueless what the error means. Or what it means that I can run it one time and no more without restarting. Help appreciated.