The right way to maya batch?

Post Reply
Zef
Posts: 3
Joined: Sun Apr 09, 2017 7:48 pm

The right way to maya batch?

Post 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?
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: The right way to maya batch?

Post 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
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
Zef
Posts: 3
Joined: Sun Apr 09, 2017 7:48 pm

Re: The right way to maya batch?

Post 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
Zef
Posts: 3
Joined: Sun Apr 09, 2017 7:48 pm

Re: The right way to maya batch?

Post 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.
Post Reply