Documentation of

Hi, I’ve found some forum posts talking about a file that you can keep in ~/ that will behave like the rootlogon.C file that ROOT runs when it opens up. I couldn’t find any real documentation about it, nor a fully detailed forum post. I tried creating such a file, but it wasn’t run when doing “import ROOT”.

Can someone answer these questions:

  • is this the PyROOT equivalent of rootlogon.C?
  • can you control where the file is found with a .rootrc setting?
  • can I just make run my usual rootlogon.C file?
  • under what conditions is a file actually executed, is it upon “import ROOT”?



“import ROOT” does not load ROOT just yet: to allow ‘batch’ mode to be set programmatically and to allow ignoring CLI arguments. First (non-gROOT) ROOT use runs ~/, unless ‘-n’ is defined in sys.argv (just like with root.exe). is imported, not execfiled(), since this gives more control within the file.

If ~/ is imported, rootlogon.C is ignored. The assumption here is indeed that rootlogon.C can be loaded from if that is desired, so yes you can do this with gApplication.ExecuteFile().

If rootlogon.C it to be loaded, it is picked up from a couple of standard places, in order, incl. gRootDir/etc. All rootlogon.C’s found are executed. is only searched for in the home directory. You can get further control by importing your own custom-named settings module inside, which will subsequently be found through PYTHONPATH.

rootrc is not checked.

Contrary to python’s startup file, rootlogon is executed both in batch and interactive.

I don’t think it is a widely used feature. Let me know if you need any changes.