All Questions

100
votes
6answers
347924 views

input() error - NameError: name '...' is not defined

I am getting an error when I try to run this simple python script: input_variable = input ("Enter your name: ") print ("your name is" + input_variable) Lets say I type in "dude", the error I am get...
3
votes
3answers
285 views

Confusion with the assignment operation inside a falsy `if` block

I was playing with the assignment operation within if blocks, and discovered the below result, which surprised me: C:\>irb --simple-prompt if false x = 10 end #=> nil p x nil x.object_id #=>...
31
votes
2answers
281928 views

Python NameError: name is not defined

I have a python script and I am receiving the following error: Traceback (most recent call last): File "C:\Users\Tim\Desktop\pop-erp\test.py", line 1, in <module> s = Something() NameEr...
29
votes
1answers
50905 views

Python: NameError: global name 'foobar' is not defined

I have written the following class: class myClass(object): def __init__(self): pass def foo(self, arg1, arg2): pp = foobar(self, arg1, arg2) if pp: return...
47
votes
2answers
63591 views

NameError: global name 'unicode' is not defined - in Python 3

I am trying to use a Python package called bidi. In a module in this package (algorithm.py) there are some lines that give me error, although it is part of the package. Here are the lines: # utf-8 ?...
8
votes
2answers
31152 views

input(): "NameError: name 'n' is not defined"

Ok, so I'm writing a grade checking code in python and my code is: unit3Done = str(input("Have you done your Unit 3 Controlled Assessment? (Type y or n): ")).lower() if unit3Done == "y": pass eli...
113
votes
3answers
68372 views

NameError: name 'self' is not defined

Why such structure class A: def __init__(self, a): self.a = a def p(self, b=self.a): print b gives an error NameError: name 'self' is not defined?
31
votes
1answers
123135 views

python: NameError:global name '...‘ is not defined

in my code, I have: class A: def a(): ...... def b(): a() ...... b() Then the compiler will say "NameError: global name a() is not defined." If I pull all the s...
52
votes
7answers
73175 views

python NameError: global name '__file__' is not defined

When I run this code in python 2.7, I get this error: Traceback (most recent call last): File "C:\Python26\Lib\site-packages\pyutilib.subprocess-3.5.4\setup.py", line 30, in <module> long_d...
15
votes
4answers
3537 views

Problem using OpenStruct with ERB

EDIT: forgot to include my environment info... Win7x64, RubyInstaller Ruby v1.9.1-p378 EDIT 2: just updated to v1.9.1, patch 429, and still getting this same error. Edit 3: running this same code in...

Previous Next