I've just recently installed Python(x,y) 2.7.5.1 on my computer with no other Python distributions installed in parallel and I have a problem with the Spyder IDE.

Namely when I create a script even a simple:

print "Hello World"

and I try to run it via the usual Runfile/F5 I get the following error:

name 'runfile' is not defined

As the button seems to be trying to use a runfile() function to run the scripts I create in the IDE.

If I try to run the same scripts by hand in Spyder's console with execfile() it works.

My question is how do I get the standard Run button and implicitly runfile() to work or alternatively to redirect the Run button to use execfile() ?

有帮助吗?

解决方案

The problem seems to go away if from the run configuration I choose the option that each script be executed in it's own new individual console.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top