Understanding error messages in Python

From Computer Science Wiki
Revision as of 10:53, 20 August 2020 by Mr. MacKenty (talk | contribs) (Created page with "right|frame|Programming<ref>http://www.flaticon.com/</ref> = Understanding error messages in Python = == Syntax Errors == Syntax errors, also known...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Programming[1]


Understanding error messages in Python[edit]

Syntax Errors[edit]

Syntax errors, also known as parsing errors, are perhaps the most common kind of complaint you get while you are still learning Python[2]


Exceptions[edit]

Even if a statement or expression is syntactically correct, it may cause an error when an attempt is made to execute it. Errors detected during execution are called exceptions and are not unconditionally fatal.[3]

How to read an error message[edit]

An error MIGHT look something like this:

  File "/Users/bmackenty/Documents/python_scratch_folder/hello_world.py", line 1
    print" Hello there" 
                      ^
SyntaxError: invalid syntax


References[edit]