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

Andreas Roehler andreas.roehler at online.de
Thu Oct 22 21:20:17 CEST 2009

Rustom wrote:
> 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

Probably you are right - if the `\r'-error doesn't occur
with `compile'. Think we should make a comment, saying
"compile" here is introduced for this side-effect.

>>>     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 :-)

Sorry. Simply tried to catch the execution of your form with edebug.
The ways I tried, it wasn't called.

Thanks anyway.


More information about the Python-mode mailing list