I am using python to run in batch mode several scripts whose produce various images; even if i have know that in a future version of ROOT even the “gif” format will be available in batch mode, for now i hae to make it works anyay… so I save the images in “eps”.
For this reasons all the scripts have an option where the user can chose the format of the image output.
All the functions have a structure similar to
XXX([…], TString format = “gif” )
The problem is that if I execute from the ROOT’s command line , for instance
.L S4Scan.c
S4Scan(//home//nagni//filesFromYoda//maurizio00", format = “eps”)
it works correctly
if i execute the script or from the python prompt (from there comes the output below…)
gROOT.LoadMacro(“/home/pamela_yoda/scriptdef/S4Scan.c)
gROOT.ProcessLine('S4Scan(”//home//nagni//filesFromYoda//maurizio00", format = “eps”)')
Error: Function S4Scan(“//home//nagni//filesFromYoda//maurizio00”,format=“eps”) is not defined in current scope FILE:(tmpfile) LINE:1
Possible candidates are…
filename line:size busy function type and name
/home/pamela_yoda/scriptdef/S4Scan.c 36:54 0 public: void S4Scan(TString base,int num=0,TString autoSc=“true”,TString outDirectory=“”,TString format=“gif”);
*** Interpreter error recovered ***
Is there any solution without being forced to set “eps” as default in the function?
Hi,
this is just due to a syntax error - you’re not writing C++. This is how to call a method:
S4Scan("//home//nagni//filesFromYoda//maurizio00", “eps”)
Axel.
function have more than 2 parameters… i don’t believe (neither you i suppose) the function can understand that i want to set just the “format” parameter to “eps”… on the other hand I am 100% sure that the way i told you works command line… any other suggestion?
Yes, still: write proper C++ :-] Invoke your method as
S4Scan("//home//nagni//filesFromYoda//maurizio00",0,“true”,"", “eps”);
In C++, there is no way to make the compiler use default args up to a certain arg, only starting from a certain arg, i.e.
S4Scan("//home//nagni//filesFromYoda//maurizio00",0,“true”);
works.
Axel.
I said that on ROOT command line it works ALSO in that way; so perhaps is CINT feature.
it remain anyway the problem on calling from PYTHON in this shape
from ROOT import gROOT
gROOT.LoadMacro(“S4Scan.c”)
gROOT.ProcessLine(‘S4Scan(“//home//nagni//filesFromYoda//maurizio00”, 0, “true”, “eps”)’)
and thats what i care most
The chance that i could do “parName = value” as on ROOT prompt could be great but even if I cannot do in that way, I neither can in the other way beacause the “gROOT.ProcessLine” command always call the default parameter “gif” no matter what and how many parameters I write beetween the parenthesis.