[Python-mode] [Bug 450552] [NEW] python-mode breaks for python 3
Andreas Roehler
andreas.roehler at online.de
Sat Oct 17 17:54:51 CEST 2009
Rustom wrote:
> Public bug reported:
>
> python 3 has removed execfile
> This makes python-mode stop working
>
> 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
>
> ** Affects: python-mode
> Importance: Undecided
> Status: New
>
IMO it's not to cure by changing a line in general.
More bugs will be around due to different flavours of python.
Versions of python 2.4.+ are in use still AFAIK.
2.5.+ or 2.6.+ will remain widely used
Will a single python-mode be able to cope with this differences?
IMHO: yes, however it must to address some issues.
Herewith some outlines what seems necessary:
- specifying by a variable the version where edits are for (customizable)
- some guessing, which python-version might be in used, if user didn't set it
- displaying python-versions-variable in mode-line
- auto-adapting code, editing and execution resp. to the mentioned version.
- possible switch between versions-specifics, updating the modeline etc.
Introducing a first item in this line might read:
(defcustom py-adressed-python-version ""
"*With different Python versions, changes have been made, which affect python execution as editing likewise.
If a version is specified here, python-mode will adapt its proceeding to it.
Otherwise python-mode will try some guess from the installed system.
You may switch the addressed python-version with M-x py-switch-addressed-version during your emacs-session. "
:type 'string
:group 'python)
Any hints, objections, ideas?
Thanks!
Andreas
--
https://code.launchpad.net/s-x-emacs-werkstatt/
http://bazaar.launchpad.net/~a-roehler/python-mode/python-mode.el/
More information about the Python-mode
mailing list