views:

1239

answers:

4

Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code?

A: 

You can use pylint for such things and there seems to be a way to integrate it into emacs, but I've never done the latter b/c I'm a vim user.

André
+7  A: 

You can use Pyflakes together with Flymake in order to get instant notification when your python code is valid (and avoids a few common pitfalls as well).

Glyph
+2  A: 

Or from emacs (or vim) you could run python -c 'import x' where x is the name of your file minus the .py extension.

mhawke
A: 

You can use pylint, pychecker, pyflakes etc. from Emacs' compile command (M-x compile).

Hint: bind a key (say, F5) to recompile.

Matt Curtis