calling python from maya does not work anymore..

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2011
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
 checkGamma.gamma()
 


Quote: # 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'
					else:
						print 'your lensShader is set to Gamma  %s' %gamma
						continue
			else:
				print 'your lensShader is set to Gamma  %s' %gamma
				continue


very thankfull for input!~
 
  03 March 2011
You sure the py code can run fine?
def global gamma()?? really? I have never seen this.
 
  03 March 2011
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)..
 
  03 March 2011
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?
 
  03 March 2011
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...

:nathaN
 
  03 March 2011
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
 
  03 March 2011
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:21 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.