calling python from maya does not work anymore..


I’m trying to call inside a standalone mel script for submitting to the farm a python script…
and messing around for hours now… wtf is wrong with this???

import sys sys.path.append('L:/_deadline/submission/Maya')
 import checkGamma

Error: AttributeError: ‘module’ object has no attribute ‘gamma’

like that what I try from within mel

python("import checkGamma"); python("checkGamma.gamma()");

and the python code I am calling inside mel is this:

import maya.cmds as mc

def global gamma():
	cams = mc.listCameras (p=True)

	for i in cams:
		isRenderable = mc.getAttr (i + '.renderable')
		if isRenderable == True:
			lensShader = mc.listConnections (i + '.miLensShader')
			gamma = mc.getAttr (lensShader[0] + '.gamma')
			if not gamma == 1:
					request = mc.confirmDialog (title='note', message='gamma is set to 2.2 change to 1.0', button= ['yes', 'no'], defaultButton='yes', cancelButton='no', dismissString='no')
					if request == 'yes':
						mc.setAttr (lensShader[0] + '.gamma', 1)
						print 'gamma was set to 1'
						print 'your lensShader is set to Gamma  %s' %gamma
				print 'your lensShader is set to Gamma  %s' %gamma

very thankfull for input!~


You sure the py code can run fine?
def global gamma()?? really? I have never seen this.


it doesn’t matter what I name my function.
global because It seems only to work like that when you source it from within mel… (acc. to internet)…


Does your def global gamma() function even work if you run it by itself? I get syntax errors when I try to define a function with global in there like you’ve put - I also never seen it used in python - could you point out the link where you saw this information?


I think you must be getting mixed up between MEL and python Sorath, you don’t “source” python from “within MEL”… I’m with earlyworm, def global is probably the problem…



hmm… ok, I think I really messed something up here.
nevermind I integrated my check routines directly in the submit script… and called all other mel stuff with maya.mel.eval


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.