Rustom wrote: > Right now the mc Im on does not have python 2.x and python3 > > But when I was on a debian box with 2.5 and 3 > changing > > (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename))) > > to > > (cmd (format "exec(compile(open('%s').read(), '%s', 'exec')) # > PYTHON-MODE\n" filename filename))) > > [ not > > (cmd (format "exec(open(r'%s').read()) # PYTHON-MODE\n" filename))) > as my original post suggested] > > seemed to work for both 2.5 and 3 > > Whether other changes from 2.x to 3 will introduce breakage in python- > mode I dont know > > The more important question remaining about my suggested fix is about windows. > Evidently there is some stupidity that exec expects its input to have unix > line endings even on windows so the original code may not work on windows but > the one with compile should. > > But Ive not tested on windows >
Hi Rustom, looks like good news. Think you are right. Checked a little bit with Python 2.5.1 on Linux 2.6.22.19-0.2-default #1 SMP 2008-12-18 10:17:03 +0100 i686 athlon i386 GNU/Linux works fine AFAIS. What puzzles me still is a pure python question - do we need this `read()' here, i.e. if a file opened is delivered to exec, will it not being read anyway? Thanks Andreas -- https://code.launchpad.net/s-x-emacs-werkstatt/ http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/ _______________________________________________ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode