Maya python, unexpected indent

Anonymous

Maya python, unexpected indent

Anonymous
Not applicable

Hi

So I'm following an online course on Udemy for Python Coding for Maya, I've written out the code the same as the instructor (per the image), I've followed everything in the video. And it doesn't work, I keep getting "# Error: IndentationError: file <maya console> line 2: unexpected indent #" This is driving me mad. Why is this happening?

Python_Indent_Problem.jpg

0 Likes
Reply
1,177 Views
3 Replies
Replies (3)

stuzzz
Collaborator
Collaborator

hello, Please make sure you have 4 spaces instead of tab as a indentation.

Is there a space right before "from maya import cmds" ?

Try to delete the first empty line

0 Likes

Anonymous
Not applicable

Hey

 

No, there are no spaces. However, I have tried it with spaces and it still doens't work. I'll try your suggestions of 4 spaces instead of a tab.

 

Thanks

0 Likes

stuzzz
Collaborator
Collaborator

ok I got it.

Your function is indented for no reason it has to have the same indentation as "from maya import cmds"