Crash when trying to execute a Python script using TPython::ExecScript


I am trying to execute (as a part of my introduction to TMVA) using TPython::ExecScript:

root[0] TPython::ExecScript("")

which results in a crash…
Im pretty sure im using it wrong, but I cant seem to find the mistake.

Help appreciated.


what kind of crash? What is inside the python file?


Root just goes unresponsive and quits, without any errors.
The python file is suppose to draw some graphs and thats it, and can be found here

it is a part of this tutorial

I think there is at least a set of mistakes. TColor does not provide the enumerator constants kAzure, kRed and so on. The right way to access those is via the ROOT module, e.g.


Changing all TColor to ROOT still results in a crash.
I’m not sure it has anything to do with the code itself, since when putting some prints even at the very beginning of the code, the crash happens before any print.

What is the platform you are running on? ROOT 6.08 on cvmfs ran from lxplus worked fine.

I am running v5.34.36 on windows.


I confirm this doesn’t work on Windows. Unfortunately, since ROOT 5 is in maintenance mode, I’m afraid this is not going to be fixed… (unless @wlav would like to look at it…)

Cheers, Bertrand.

Well, I’m guessing there’s another way to execute the script through a python interpreter, right?

Could anyone guide me through that? (I’m very new to this)

The main problem now is that “” imports ROOT, and so I’m not sure how to execute it without moving the script to the folder of the interpreter.

Did you try: python ?

Just a piece of info.

I am not aware of all details but I think the tutorial has been written for ROOT6 which is also where all new tmva developments go.


OK, seeing that all of the new good stuff are in root 6, i’ll probably just install a dual boot on my computer with linux as well as windows so I could have root 6.

before I go do that, are there any other suggestions maybe?

Well, executing your script from python just works for me:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile('')
Info in <TCanvas::Print>: file var0.png has been created
Info in <TCanvas::Print>: file var1.png has been created
Info in <TCanvas::Print>: file var0var1.png has been created

OK, all of the problem are now solved (at least partially).
After opening my python cmd and executing these commands

>>> import sys
>>> import os
>>> sys.path.append("D:\\root_v5.34.36\\bin")
>>> os.chdir("D:\\root_v5.34.36\\bin")
>>> execfile('')

I indeed get the wanted result.

However, since the idea is eventually to use TMVA, I now wonder if I should install linux so I can have root6. Is it critical or is working with root5 good enough?

Anyway thank you everyone!

It depends what you need… Just try :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.