Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Maya python, unexpected indent

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1148 Views, 3 Replies

Maya python, unexpected indent

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

3 REPLIES 3
Message 2 of 4
stuzzz
in reply to: Anonymous

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

Tags (1)
Message 3 of 4
Anonymous
in reply to: stuzzz

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

Message 4 of 4
stuzzz
in reply to: Anonymous

ok I got it.

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report