SetEnv command in plugin

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?

Thanks

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/")

Here’s the documentation for this function:
msdn.microsoft.com/en-us/library … hods(VS.80.aspx

Cheers,

  • Ryan

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?

Thanks

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 )
    ...

The .NET library references can all be found at msdn.microsoft.com.

Cheers,

  • Ryan

it seems to be impossible to import some python modules in iron python, like import os returns an error, os.path too.

Is there a list of module that don’t work for iron python?

IronPython just implements the built-in libraries. See this link for more details:
lists.ironpython.com/pipermail/u … 04762.html

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.

Cheers,

  • Ryan

right… thanks for the info