Reputation: 2764
I'm using PyDev 2.5 in eclipse. When ever I use a raw_input command and I enter some text in the console this gets interpreted a console command resulting in a NameError.
For example:
I run name = raw_input('name:')
I reply: name:martin
and I get as a result:
Traceback (most recent call last): File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc\pydevd_comm.py", line 755, in doIt result = pydevd_vars.evaluateExpression(self.thread_id, self.frame_id, self.expression, self.doExec) File "C:\Program Files\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc\pydevd_vars.py", line 384, in evaluateExpression result = eval(compiled, updated_globals, frame.f_locals) File "", line 1, in NameError: name 'martin' is not defined
the script seems to continue with name being 'martin' as expected but the console is getting cluttered with this error messages. Is there any way of getting rid off the NameError messages in the console?
The most similar post I found is: Greeting program but I'm using raw_input already.
I have also tried raw_input().replace('\r', '') and eval(raw_input().replace('\r', '')) as suggested in http://pydev.org/faq.html#PyDevFAQ-hyrawinput%28%29%2Finput%28%29doesnotworkcorrectlyinPyDev%3F but I still have this strange behavior.
Thanks Martin
Upvotes: 2
Views: 1324
Reputation: 25362
From the stack trace, it seems the error is happening when PyDev is trying to evaluate some expression you have in debug mode (probably from your Expressions view or when hovering some variable)
This also means that you're probably running your program in debug mode, not in release mode (so, if you really want to run it in debug mode, remove that expression from your expressions view, otherwise, run the program regularly and not inside debug mode).
Upvotes: 0