Larning to write code in with Python

Larning to write code in with Python

kazinsks
Participant Participant
360 Views
3 Replies
Message 1 of 4

Larning to write code in with Python

kazinsks
Participant
Participant

Hello, 

 

learning to write code and started with video 1 day one on you tube and can't get a simple scrip to run correct withourt "syntax error". Thoughts...?

 

 

kazinsks_0-1670435007578.png

 

0 Likes
Accepted solutions (2)
361 Views
3 Replies
Replies (3)
Message 2 of 4

kazinsks
Participant
Participant

update scripting works in MEL but not python. However, the video for learning is for python... confusing...

 

Message 3 of 4

RFlannery1
Collaborator
Collaborator
Accepted solution

You need parentheses around the string to be printed.  Like this:

print("hi")

The video may be using an older version of Python.  Maya 2020 and earlier versions used Python 2.  In Python 2, "print" was a statement instead of a function.  So you could use it without parentheses.  But in Python 3, "print" is a function.  And functions require parentheses.

Message 4 of 4

kazinsks
Participant
Participant
Accepted solution

beautiful! Thanks