[Python-mode] [Bug 450552] Re: python-mode breaks for python 3

Rustom Mody rustompmody at gmail.com
Thu Oct 22 18:03:08 CEST 2009

On Thu, Oct 22, 2009 at 8:32 PM, Andreas Roehler
<andreas.roehler at online.de>wrote:

> ...
> >     >     Rustom wrote:
> >     >     > (cmd (format "exec(compile(open('%s').read(), '%s', 'exec'))
> #
> >     >     > PYTHON-MODE\n" filename filename)))
> >
> >     For me both of your variants are working, see output of checks below.
> >
> > You probably need to try on windows.
> > See
> > http://bugs.python.org/issue5524
> Hmm, AFAIU the use of `compile' here on windows is to signal an error if
> the file contains "\r" chars?
> Right?
The way I understood it the exec want Unix-only lineendings and compile
avoids the whole issue by supplying exec with a code object and not a
compilable text.
But I may be wrong

> >     Do you have some tests for python-mode.el?
> >
> > As in automated el/py etc? No
> > As in biological? ...
> If you may deliver a simple test case, how to call interactively it from
> inside emacs,
> it might be helpful - at least for me... :)

Not sure what you are asking for.
Your emacs startup should contain something like

(autoload 'py-shell "python-mode" "Python Inferior Mode." t)
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

Also assuming that python-mode.el is in your path

After that opening a file with .py extension should start in python mode
>From there C-c ! should start the python interpreter
After that (from the file buffer) C-c C-c should read the file into the
python interpreter buffer.

But as I said I am not sure what you are asking for :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-mode/attachments/20091022/63d0b518/attachment.htm>

More information about the Python-mode mailing list