Error message 'Error in <TWinNTSystem::BaseName>: name = 0'

Hi,

I get this weird (and annoying) error message when I tell Root not to use arguments and then set the warning level:

cplager@Plager-PC1} python
ActivePython 2.6.6.18 (ActiveState Software Inc.) based on
Python 2.6.6 (r266:84292, Jan  7 2011, 13:16:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.PyConfig.IgnoreCommandLineOptions = True
>>> ROOT.gErrorIgnoreLevel = ROOT.kWarning
Error in <TWinNTSystem::BaseName>: name = 0
Error in <TWinNTSystem::BaseName>: name = 0
>>>

If I don’t tell root not to use the command line options, I don’t see this:

cplager@Plager-PC1} python
ActivePython 2.6.6.18 (ActiveState Software Inc.) based on
Python 2.6.6 (r266:84292, Jan  7 2011, 13:16:36) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.gErrorIgnoreLevel = ROOT.kWarning
>>>

What’s going on? How do I make it go away?

Thanks,
Charles

Charles,

not quite sure: it appears to be Windows specific and I don’t have access to a Windows box ATM.

From the looks of it, the failure comes from this line (see core/winnt/src/TWinNTSystem.cxx):

which is the only line I see in TWinNTSystem that deals with both BaseName and the input args. What I find odd, though, is that even if the python list of args is empty, TPyROOTApplication will still fill in at least a program name on argv[0], from Py_GetProgramName(), so argv[0] should never be empty. Maybe that’s different on Windows: on Linux, Py_GetProgramName() returns “python” even with an empty sys.argv.

One way around it, might be to do something else before setting gErrorIgnoreLevel: in the example that you post, gErrorIgnoreLevel is the first “ROOT thingy” and on its access, the TPyROOTApplication etc. are created. Deferring it by touching something else first (e.g. ROOT.kRed) should to the trick (is a guess, though, as again, I can’t try it out right now w/o a Windows box).

Cheers,
Wim

Actually, it’s the other way around. If I set the warning level first, the error messages goes away. In my original code, I was setting the warning level in the middle of the code and had to move it to the top (right after ‘import root’) to stop it.

(It would be nice if this could eventually be fixed, but if this work around works, then I can be a little more patient than usual :slight_smile: ).

Cheers,
Charles

Hi,

still no time to tackle a Windows box, so I’ve simply added protections against Py_GetProgramName() returning NULL or “” (in which cases, “python” will be used). Hope that’ll do.

Cheers,
Wim