execfile in python3 breaks emacs mode

2009-10-04 Thread Rustom Mody
Removing execfile from python3 has broken the good-ol python-mode of emacs.

Changing the line

In python-mode.el in function py-execute-file changing the line
(cmd (format execfile(r'%s') # PYTHON-MODE\n filename)))

to
 (cmd (format exec(open(r'%s').read()) # PYTHON-MODE\n filename)))

seems to solve the problem

Since I am not quite upto the subtleties of what all has changed vis-a-vis
exec/execfile, please inform me if this is ok
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execfile in python3 breaks emacs mode

2009-10-04 Thread Rustom Mody
Just answering my own question
A little googling tells me to use

(cmd (format exec(compile(open('%s').read(), '%s', 'exec')) #
PYTHON-MODE\n filename filename)))

instead of
(cmd (format exec(open(r'%s').read()) # PYTHON-MODE\n filename)))

sheesh!

On Sun, Oct 4, 2009 at 6:57 PM, Rustom Mody rustompm...@gmail.com wrote:

 Removing execfile from python3 has broken the good-ol python-mode of emacs.

 Changing the line

 In python-mode.el in function py-execute-file changing the line
 (cmd (format execfile(r'%s') # PYTHON-MODE\n filename)))

 to
  (cmd (format exec(open(r'%s').read()) # PYTHON-MODE\n filename)))

 seems to solve the problem

 Since I am not quite upto the subtleties of what all has changed vis-a-vis 
 exec/execfile, please inform me if this is ok

-- 
http://mail.python.org/mailman/listinfo/python-list