← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #595513]: Blank log file when run from command line

 

Question #595513 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/595513

RaiMan proposed the following answer:
ok, understood.

Since you do not see anything in the logfile, you are using simple print
statements for your "logging" and not the features as described here:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#writing-and-
redirecting-log-and-debug-messages (which is the kind of logging, as it
is used in SikuliX).

the print statement's output in the standard goes to stdout, which in turn in the IDE is per default redirected to the message area.
see: http://sikulix-2014.readthedocs.io/en/latest/faq/010-command-line.html
and the option -c to start the IDE from a commandline and switch off the message box, so all print output goes to stdout (commandline), which in turn can be redirected to a file using > (as you already did for a scriptrun).

you might also use the print statement to directly print to a file:
fLog = open(fnameLog, "w")
print >> fLog, "print test"
fLog.close()

where fnameLog is a valid filename string, that might be formed using os.path.join()
all this is standard Python

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.