Error:Python:type exceptions.NameError

From IPRE Wiki
Jump to: navigation, search

Cause

This error occurred because you referred to a variable that doesn't exist yet.

Solution

Make sure that variables are defined with an initial value.

Consider this code:

x = x + 1

If x were not previously defined, then it would cause this error. the solution is to provide an initial value for x:

x = 0
x = x + 1