NameError: name 'execfile' is not defined
Gary Herron
gherron at islandtraining.com
Thu Mar 12 03:15:40 EDT 2009
Henrik Bechmann wrote:
> Newbie issue:
>
> I downloaded http://www.python.org/download/releases/3.0.1/ (windows
> insaller), opened the interpreter, wrote a print "Hello World" program
> in helloworld.py, and in the interpreter typed
>
> execfile("helloworld.py")
>
> Got back
>
> NameError: name 'execfile' is not defined
>
> (following tutorial in David Beazley's Python Essential Reference).
>
> Is execfile not supported in 3?
>
That's correct.
From http://docs.python.org/dev/3.0/whatsnew/3.0.html you can find this
line:
Removed execfile(). Instead of execfile(fn) use exec(open(fn).read()).
Gary Herron
> Thanks,
>
> - Henrik
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list