Mayapy.exe and pymel.core

Hello,

I just got Rob Galanakis’ book Practical Maya Programming with Python.
I got stopped here at the first chapter though.

running mayapy.exe

>>> import maya.standalone
>>> maya.standalone.initialize()
>>> import pymel.core as pmc

when I run the import pymel.core line I get this error:

Warning: file : C:/Program Files/Autodesk/Maya2013/scripts/startup/initialStartup.mel line 192: Y-Axis is already the Up-axis
pymel.internal.startup : ERROR : could not perform Maya initialization sequence: failed on namedCommandSetup.mel: Error occurred during execution of MEL script

I’m on Windows 7 and this happens for both Maya 2013 and 2014.
I don’t really get what’s wrong. The script it’s talking about is in there but I don’t know where it’s breaking at. I don’t think it’s even a script I should be changing right?

Thanks,
Jesse

I get that same error(at least in 2014), but it doesn’t seem to actually impact my ability to use pymel from mayapy.
You can check to see if its loaded by doing a dir(pmc), and if a whole lot of text spams you, then the module loaded properly.

If you want to avoid the error entirely you can try adding this before you import pymel. It seems to work for me at least.


import maya.mel
maya.mel.eval('source "namedCommandSetup.mel"')

Oddly that mel eval is taken right from the pymel startup, so no idea why it works if called before, but not during (or after).

Thanks R. White, it works fine!
I didn’t think to check if the modules actually loaded haha.