Hi, in Deadline 2.7 I use the SetEnv command to set environement variable before rendering
In the PreRenderTasks.ffs I added this line : SetEnv( “MAYA_SCRIPT_PATH”, “//Path/to/my/scripts/”)
I Deadline 3.0 I am trying to do the same in the PreRenderTasks method of the MayaCmd.py file, I looked in the Plguin documentation but I can’t find this method.
… while writing these line I realised that I could use python commands to do so. Do I have to use Python commands or do you have this method available?
Because Deadline 3.0 uses IronPython, you can add .NET calls to your python script. So you can use the python commands to set the environment variable, or you could do this:
from System import *
...
Environment.SetEnvironmentVariable("MAYA_SCRIPT_PATH", "//Path/to/my/scripts/")
Thanks Ryan. I found how to do it in python so I think i’ll stick to that.
But for futur reference, to get acces to dotNet function I only need to import System?
It depends on what .NET functions you’re using. Basically, you have to import the namespace for the particular class you want to use. For example, the Environment class is from the System name space, so you import System. Path or File are from the System.IO namespace, so you would have to import from System.IO:
from System.IO import *
...
filename = Path.Combine( someFolder, "file.txt" )
if File.Exists( filename )
...
Basically, to use os, you would have to have python installed on the machine, and then configure the IRONPYTHONPATH environment variable to point to the lib folder of the python installation.