MM: Developing Modular Rigging Systems with Python Help
Well, this is embarrassing, it looks like I'm stuck already, I've gone through the blueprint_UI.py six times and cant see a single error, it did report that it was in the constructor, so the file is being referenced, but when trying to run the completed code to launch the window I get the error below. I cant find the syntax error anywhere
# Error: ('invalid syntax', ('C:/Projects/RiggingTool/Modules\\System\\blueprint_UI.py', 8, 53, '\t\tif cmds.window("blueprint_UI_window", exists=True)\n'))
# Traceback (most recent call last):
# File "<maya console>", line 14, in <module>
# File "C:/Projects/RiggingTool/Modules\System\blueprint_UI.py", line 8
# if cmds.window("blueprint_UI_window", exists=True)
# SyntaxError: invalid syntax #
Missing the colon after ("blueprint_UI_window", exists=True):
Last edited by Pharion; 04-07-2010 at 06:39 PM.
I now also know that the error "Error: ('non-keyword arg after keyword arg', " translates to, "Youv'e not put in the '=' you dumbass"
Hehe, after a while you should become familiar with what most of the errors relate to. Takes a bit of getting used to
Glad you solved your problem!
Hi Steve, I think you've Jinxed me great work by the way, this has got me really excited and I'd learning an amazing amount about scripting.
Doing well up to here when I tested the script:
UI = blueprint_UI.Blueprint_UI()
As soon as I added the
for module in utils.findAllModules("Modules/Blueprint"):
def createModuleInstallButton(self, module):
I get the following error... been going at it for four hours now, and still haven't found where I've gone wrong?
# Error: Blueprint_UI instance has no attribute 'createModuleInstallButton'
# Traceback (most recent call last):
# File "<maya console>", line 17, in <module>
# File "C:/Projects/RiggingTool/Modules\System\blueprint_UI.py", line 28, in __init__
# self.initialiseModuleTab(tabHeight, tabWidth)
# File "C:/Projects/RiggingTool/Modules\System\blueprint_UI.py", line 51, in initialiseModuleTab
# AttributeError: Blueprint_UI instance has no attribute 'createModuleInstallButton' #
Haha, I hope I haven't Jinxed ya!
Glad to hear that you're enjoying the training and learning lots about Python scripting
The error is suggesting that the method "createModuleInstallButton()" doesn't belong to the Blueprint_UI class. Now, obviously the class is supposed to have that method (and the code you posted includes a definition for the method that should be correct). That leads me to think that perhaps the indentation isn't quite right, and in Python the indentation is essential because it determines which code belongs to certain 'blocks' if you will (i.e. which code forms the class, which code belongs to a certain method definition, etc.).
I'd recommend double checking to make sure the definition of createModuleInstallButton is such that it's nested inside the class definition, and that it's not being defined outside the class. If you're still having trouble, feel free to PM me (as I'm sure you're aware, small code snippets like the above are totally acceptible on the forums, but we'd like to avoid lengthy code getting posted, for obvious reasons ) the entire code for the file so far (you'll probably need to put it in code tags so as to preserve indentation) and I'll take a more detailed look at what seems to be the problem.
All the best,
You sir are a gent amongst giants, and a frikin genius to boot deleted all the indentation, and stuck it back in again, all working... now know a new thing to look out for.... thanks again
Glad I could help!
wow, indentation in python can really bite you in the ass, sometimes you dont even get an error, just strange results, here is an after and a before I found the bug: yep got the images backwards
Last edited by Pharion; 04-11-2010 at 05:45 PM.
The attachment doesn't seem to work ... and I really wanted to see the crazy results you were getting!
It's fairly easy for a line or two of code to slip into a different code block if you're not careful! You'll quickly get the hang of it, however, and then it shouldn't be a problem , it's just something to keep close attention on when coding, much like any other syntax. It helps to use an editor like Notepad++ that draws lines indicating different levels of indentation
[IMG]file:///C:/Users/Stephen/AppData/Local/Temp/moz-screenshot-6.png[/IMG]Hi Steve, this is what I got when messing up the indentation... been busy but just managed to complete vid 15 without any difficulty... but my god you say container allot
Tags for this Thread