Python files as executables

Hey,

I tried today to have a python script be run instead of a plugins executable, and it fails.

Is this possible?

I know we can do use the Python plugin, but it would be good to setup the environment with scripts as executables.

Hello,

Can I have you verify what os this is being run on? Do you have a bitness check on which could be failing it? Can you explain the situation more? The only idea I have is to make a batch file with python in front of the script, which could be run from the plugin.

Cheers,

Its on Windows 7. What do you mean with bitness check?

The situation is that that we want to run more and more customization from the network, so all our tools are centralized in one place. The easiest method is to have python script to setup environments and launch applications, so plugins etc. works across all machines.

I’ll have a look at some more information tomorrow, but is running batch scripts supposed to work?

As an example of a batch script;

"C:\Program Files\Autodesk\Maya2015\bin\mayabatch.exe" %1 %2 %3 %4 %5

Error;

Error: "K:\tools\bait-launchers\mayabatch_2015.bat" does not have a valid DOS signature value, so is not a PE or not a dll/exe (System.Exception) at FranticX.IO.File2.Is64BitDllOrExe(String filename) at FranticX.IO.File2.SearchFileListFor64Bit(String[] list) at Deadline.Scripting.FileUtils.SearchFileListFor64Bit(String fileList) at Python.Runtime.Dispatcher.TrueDispatch(ArrayList args) at Python.Runtime.Dispatcher.Dispatch(ArrayList args) at Deadline.Plugins.DeadlinePlugin.StartJob() at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel) at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

Even when converting that to an exe file I still can’t get it to work, with an error of;

Error: 64 bit Maya 2015_0 render executable was not found in the semicolon separated list "K:\tools\bait-launchers\mayabatch_2015.exe;". The path to the render executable can be configured from the Plugin Configuration in the Deadline Monitor. at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

Hello Toke,

So it looks like the issue is the bitness check, which is the ‘build to force’ drop down in the submitter. If you make sure that is changed to none, the script should run.

Awesome, got the batch scripts to work:)

Now are Python scripts supposed to work?

Hi Toke,
Is the path to your Python in your PATH? If so, then yes, executing a Python script would be the same as executing it in a command prompt. If not, then your app plugin will need to be told where Python is on your system and then be passed the path to the python script and/or passed arguments.

I’m getting an early termination error on the renders, which I’m guessing is to do with using “subprocess” to open mayabatch?

Possibly. Would need to see the code to see what is going on here. I’m wondering if you could use our existing MayaBatch plugin, which has the ability to execute ‘MELscript / Python script’ jobs already, or at least use this plugin as a starting point for any custom plugins you may wish to expand upon? Generally, I skip Python’s subprocess and use our built-in process utils:
docs.thinkboxsoftware.com/produc … utils.html

Thanks Mike, I’ll look into what the plugin script is doing.

I ended with the batch script option and submitting the jobs with no bitness check.

I was wondering though about this environment setup business whether we could have environment per plugin?

I know there are environment per job, but most of the time a studio will just setup one environment per plugin, so everyone is using the same environment.

Sure, you could use a JobPreLoad.py file.
docs.thinkboxsoftware.com/produc … e-optional

The JobPreLoad.py file is perfect:) That’s actually what I was looking for all along.

For other peeps, our setup is to copy the existing MayaBatch plugin into the repo/custom/plugins and add the JobPreLoad.py. This overrides the plugin to use, and loads the JobPreLoad.py file for the setting up the environment.