Python script works fine in Maya.exe but breaks in Mayabatch

346 views
Skip to first unread message

afab...@gmail.com

unread,
Mar 25, 2015, 4:00:07 PM3/25/15
to python_in...@googlegroups.com
Hi,

we have a Python script that works fine in Maya.exe GUI but breaks at multiple points in Mayabatch.
The script itself is not very complicated, it moves a bunch of locators to points on a curve.

New to Maya (ex Softies), we must be missing something major.

To simplify, bellow is a snippet that tries to save a scene after creating a circle in it. This actually crashes Mayabatch 2015 Ext 1 Sp5. Why oh why??

print "OPENED!"
import maya.cmds as cmds
cmds.circle(r=10, d=1, n="test_Curve", s=20,)
cmds.file( rename='\\\\MyServer\\Maya_Tests\\Tools\\test.ma')
cmds.file( save=True, type='mayaAscii')
print "SAVED!"

Any ideas?

Cheers,
F.

Anthony Tan

unread,
Mar 26, 2015, 9:49:00 PM3/26/15
to python_in...@googlegroups.com
It *should* be dumping out some kind of useful error, if you can post
that might help? There's possibly a few things exploding but it's hard
to tell without more context (along with how you're invoking mayabatch)

Just taking a stab in the dark though, you maaaay want to be using
mayapy.exe (vs mayabatch), and make sure you do the init sequence. (see:
http://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Maya/files/Python-Python-from-an-external-interpreter-htm.html
)

so in my case, i'd invoke things as follows:

.\mayapy E:\fish.py


# with contents of e:\fish.py being:
import maya.standalone
maya.standalone.initialize( name='python' )

import maya.cmds as cmds
cmds.sphere()
cmds.file( rename=r'e:\fish.ma')
cmds.file( save=True, type='mayaAscii')
print "SAVED!"



> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to python_inside_m...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/fdaf7e2c-200a-4a92-8737-63f4247c9758%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages