Emacs Python-mode. Newbie problem.

Piet van Oostrum piet at cs.uu.nl
Thu Jul 9 07:31:44 EDT 2009


>>>>> Lacrima <Lacrima.Maxim at gmail.com> (L) wrote:

>L> Thanks for your reply!
>L> My file name is 'trains.py'.
>L> When I do C-h k C-c RET, it shows me help from manual: "C-c RET runs
>L> the command py-execute-import-or-reload
>L>    which is an interactive Lisp function in `python-mode'..." and so
>L> on.

>L> And still when I do C-c RET, I receive "(Shell command succeeded with
>L> no output)"

>L> Any more help would be really appreciated, because I am newbie with
>L> Emacs.

I tested it and I can get this message also. It happens when you have no
Python shell running (*Python* buffer). The python code is then executed
by calling the python shell command and catching the output. This output
is displayed in the *Python Output* buffer. It happens also with C-c C-c
and it will give the same message.

There is a difference, however between C-c C-x and C-c RET: The latter
will import your module, and most modules are written such that
importing them doesn't print anything. If you add something like 
print "test" and the end of file, then "test" will appear in the *Python
Output*  buffer.

If your file has the print "hello world" statement it should display in
the *Python Output* buffer. I checked that.

On the other hand, if you have a python shell running you must make sure
(e.g. with the cd command) that its working directory is the directory
where your python file is located, otherwise the import statement will
not find your file. Unless it is somewhere in the python path. Also the
*Python* buffer will not automatically pop up if it is not visible, in
contrast with the *Python Output* buffer.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list