rrPythonconsole
You can use rrPythonconsole instead of the default python executable.
So you do not have to install Python on every render farm machine.
The module search path is set by default to RR/plugins/python_modules
Usage Examples:
rrPythonconsole "pythonfile.py"
rrPythonconsole pythoncommand pythoncommand pythoncommand pythoncommand ...
If the first commandline flag is not a filename and does not end with .py, then the flags are executed as python commands.
rrPythonconsole pythoncommand pythoncommand pythoncommand pythoncommand -yourFlag ignored ignored.
Note: rrPythonconsole stops executing commands if a flag starts with a minus sign.
And ignores everything after that flag. You can use the python module 'argparse' to load your flags:
rrPythonconsole "if (something):~n" " pythoncommand~n" " pythoncommand~n" " pythoncommand~n" ...
rrPythonconsole "if (something):~n" ~tpythoncommand~n ~tpythoncommand~n ~tpythoncommand~n ...
In case you want to pipe multiple python lines, use the following replacements for special characters:
Tab: ~t
New Line (LF, \n) : ~n
rrPythonconsole print(~qHello World!~q)
In case you cannot use quotation marks in your commandline, use this replacement instead:
Quotation mark: ~q
rrPythonconsole -noLogTime "pythonfile"
rrPythonconsole -noLogTime pythoncommand
By default, rrPythonconsole prepends the current date+time to all log outputs.
Disable this behavior by using the -noLogTime as first commandline argument:
rrPythonconsole -pythonModPaths "myPath"
rrPythonconsole loads custom python modules from the folder RR\plugins\python_modules.
The env var PYTHONPATH is NOT used by default.
Therefore you can add additional search paths with the commandline flag -pythonModPaths.
Note: Instead of adding the paths via a commandline flag, you can use the file RR/plugins/python_modules/pythonSearchPaths.pth as well
Add Commandline Arguments to your python script
You can use any commandline argument in your script.
We recommend using the argparse module.
Example:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-jid")
parser.add_argument("-authstr")
args = parser.parse_args()
print args.jid
print args.authstr