Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2008
    Location
    Shalimar
    Posts
    21

    Modular Rigging with Python.

    Anyone else having a problem in the 9th lesson
    on line 59 with the implementation of the button?
    I keep getting an indent error that I can't seem to fix.
    Done it 4 times now....same result.
    I'm in 2010, so I don't get why it's not working.
    My code looks identical to Steve's.
    Do I need to install Python on my system maybe? ....and if so, what version.
    Or has anyone else gotten past this?

  2. #2
    Join Date
    Mar 2005
    Posts
    939
    I don't have Maya, but an indent error in Python could mean that you used spaces in place of tabs or vice versa. You can't use them interchangeably for the same level of indentation.
    Last edited by pellea72; 07-26-2018 at 10:27 PM.
    "I don't WANT to pet the chicken."

  3. #3
    Join Date
    Jul 2008
    Location
    Shalimar
    Posts
    21
    Ha, didn't know that. I just went through both scripts an re-tabbed it all and its working. Thanks man!!

  4. #4
    Join Date
    Mar 2005
    Posts
    939
    No problem. You probably know that indentation is part of the syntax in Python, where it is just recommended in other languages.
    "I don't WANT to pet the chicken."

  5. #5
    Join Date
    Jul 2008
    Location
    Shalimar
    Posts
    21
    Well I had it all indented, just didn't know I was required to use tab.

  6. #6
    Join Date
    Mar 2005
    Posts
    939
    Technically you can use spaces or tabs. You just have to be consistent for each level of indentation within the same block of code. You can even mix them, which I don't recommend.

    Code:
    def function1():
    <sp><sp>x = 10
    <sp><sp>if x == 10:
    <sp><sp><sp><sp>print "x = 10"
    
    def function2():
    <tab>x = 10
    <tab>if x == 10
    <tab><tab>print "x = 10"
    
    def function3():
    <sp><sp>x = 10
    <sp><sp>if x == 10
    <sp><sp><tab>print "x = 10"
    "I don't WANT to pet the chicken."

  7. #7
    Join Date
    Jul 2008
    Location
    Shalimar
    Posts
    21
    Well I'm several hundred lines of code in now with no more problems, so I'll just stick with tabs. Thanks again.Click image for larger version. 

Name:	FB_IMG_1532955137425.jpg 
Views:	29 
Size:	28.5 KB 
ID:	74768

  8. #8
    Join Date
    Apr 2011
    Posts
    103
    If you want to give it a try I recommend taking a look at PyCharm. It is an IDE for python from JetBrains. Last I tried it took a bit to get it hooked up to Maya's python interpreter. However once it was hooked up it made me far more productive. It will automatically detect syntax errors, has code completion so you don't have to really worry about spelling mistakes and various other things, things that I found annoying when trying to work out of a notepad like text editor like notepad++ or Maya's script editor.

    On a side note I have been wanting to start the Modular Rigging course. I picked it up on the sale 3DBuzz had awhile back but I haven't had time to start.

  9. #9
    Join Date
    May 2018
    Posts
    5

  10. #10
    Join Date
    Jun 2016
    Posts
    16
    thank you very much Dain!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •