Class Notes (834,721)
Canada (508,692)
CMPT 165 (21)


25 Pages
Unlock Document

Computing Science
CMPT 165
Colin Stewart

Common Python ErrorsBefore being able to determine what your error is and how to fix it first what kind of error is itThere are three main possibilities the error occurs when I try to run the program before the program actually startsAn error message appears in a little box that says Syntax Errorlike thiso this is a syntax errora problem with the format or spelling of your code the error occurs while the program is runningAn error message appears in red text inside the Python shelllike this Traceback most recent call lastFile EProgram FilesPython25errorpy line 1 in module print x NameError name x is not definedo this is a runtime error there is no error messageThe program just doesnt do what I want it toOr there is an error message but only under certain circumstances other times the program runs fine o this is a logic error there is an error message in a little box but it does not say Syntax Errorfor exampleIO Warning or Subprocess Startup ErrorOr random text appears in the Shell after rawinput runs in your program o this is a special errorCommon ErrorsSyntax Errors3 Missing quotation mark3 Missing bracket4 Missingbetween quoted text and a variable5 Typo misspelling6 Invalid variable name7 Confusingand 8 Indentation problem9 Escape character error10 Missing colon after ifelifelsefor11 Condition after else12Runtime Errors13 Using a variable that doesnt exist13 Misspelled variable name14 Converting something that cannot be converted16 List index error17Logical Errors18error19 x1Incorrect ifelifelse structure20 Misspelled variable name22Special Errors23 Unrecognized character23 Subprocess Startup Error24 Weird text in the Python Shell after rawinput25
More Less

Related notes for CMPT 165

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.