I have a couple suggestions that might help, specifically in this situation, and also to prevent some future frustrations. Some of it is just Maya-scripting related and some of it is Python idiom:
http://pastebin.com/yR5PXwG3 It is a lot easier to use functools.partial for passing a callback to controls that will need to make use of variable and functions local to your own script. That way you can be 100% sure of the scope that is being used when it is evaluated doing import * can become confusing when you have clashing names. In your script you had a function being imported and also a local one that wraps it and its hard to know what is being used in your text-based callback. Try to use the module namespace to help you differentiate the origin of imported code. In my version of the example, we just create the control first, then edit it to add the callbacks once we have the valid control path A python idiom is to use lower case module names, lower case local variables, and lower case functions. Uppercase should be reserved for classes and constant/global variables. This makes it a TON easier to identify what variable might be in the middle of a spot in code. You know if you are instantiating a new instance of a class vs calling a function. Does this work for you? I just gave it a quick tweak and test to make sure it didn't produce the same errors. I'm sure the problem was mainly related to the way the callbacks were being applied. On Sep 14, 2013, at 12:54 AM, Daz wrote: > Heya > > I'm building another script. So far in past I didnt have problem with it but > this time I somehow cant link my files together... I cant figure out why :( > > Can some 1 have a look please? > > http://pastebin.com/iY7Dv6v5 > > There are 3 scripts there, script 1/2/3 are basically different files on my > HDD. > > 1st is shortcut > 2nd is UI > 3rd is Functions > > Error I get is this: > > # Traceback (most recent call last): > # File "<maya console>", line 1, in <module> > # File "D:/Scripts/maya/scripts/Daz_Toolkit/Fin/Modules\LightEditor.py", > line 4, in LIT_Value > # rb0 = cmds.radioButton(a,q = True,sl=1) > # RuntimeError: Object > 'MayaWindow|scrollLayout|tabLayout17|Lights|radioButton27' not found. # > > I guess I have to namy my object somehow but not sure I thought I already did > that. > > Thanks, bye. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
