Page 1 of 1

The right way to maya batch?

Posted: Sun Apr 09, 2017 8:11 pm
by Zef
Hello there !
I used cgru for blender since a few years with happiness :) but now I've to work with Maya.
I would like to Maya batch some alembic export. I've written a little python script and everything runs fine when I launch Maya batch in CLI, like this :
mayabatch ls2_ch_jessica_mdl.ma -command "python (\"import publish.exporters as exp; exp.abcModelingExport('S:/output.abc')\")"

But when I try to use afanasy(I create the job with Python), I've got no abc output, and the task log show an error of python environment, preventing Maya batch to get Maya module.

I tried to setup PYTHONHOME with the block.setEnv , but it doesn't work.

Soooo... What should I do to launch a basic command line in Afanasy?

Re: The right way to maya batch?

Posted: Mon Apr 10, 2017 9:29 am
by timurhai
Hi.
For more information you can paste task output here.
Also you should place CGRU version and you platform (OS) here.
AfRender uses Python for services and parsers.
For example on windows CGRU contains own Python3 and set PYTHONHOME to use it.
Maya uses own Python2.
So if PYTHONHOME is set to some other conflicting Python version, Maya will crash.
If you want to run some custom command and not use CGRU Python, you should set PYTHONHOME to an empty value.
Do not run Maya binaries directly, write a small wrapper to tune environment.
See how CGRU native software setup do it:
https://github.com/CGRU/cgru/blob/maste ... p__all.cmd

Re: The right way to maya batch?

Posted: Mon Apr 10, 2017 5:47 pm
by Zef
hello, and thanks for your quick answer!

I try to make a wrapper like this :
set PYTHONHOME=
start "" "C:\Program Files\Autodesk\Maya2016\bin\mayabatch.exe" %*


and add it with python like this (wit no service)

task.setCommand('"d:\\mayabatch.cmd" ls2_ch_jessica_mdl.ma -command \"ls -sl\"')

but the task output is now this
'd:\mayabatch.cmd" ls2_ch_jessica_mdl.ma -command "ls' n'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
(which means the comand is not recognized)

'I'm on windows, with CGRU 2.2.1

Re: The right way to maya batch?

Posted: Tue Apr 11, 2017 7:51 am
by Zef
It works finally, even without a wrapper.
I found that if I start the command by :
SET PYTHONPATH = &&mayabatch...
it works. I've tried this before but I used a semicolon seperator, and it doesn't work. The semicolon doesn't interpret the right part of the command.