Pyflakes and IPython does not work for Emacs on Windows?

Dsrt Egle dsrtegle at gmail.com
Fri Sep 24 19:54:07 EDT 2010


On Sep 24, 2:26 pm, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:
> On Friday, September 24, 2010, Dsrt Egle <dsrte... at gmail.com> wrote:
> > Hi,
>
> > With Python on Windows, I tried to use Emacs as the programming
> > environment. For syntax checking I installed pyflakes, but flymake
> > always reports "fail to launch. No such file or directory: pyflakes"
> > when opening a Python file. Is pyflakes not for Windows? What Python
> > syntax checking tools work for Emacs on Windows?
>
> > I can't invoke IPython by Emacs on Windows, either. Looks ipyhon.el
> > only works for Linux?
>
> I don't use emacs but my guess would be that this is a path issue. In
> Linux, most executables, like ipython, are put into /usr/bin or
> /usr/local/bin. Both ipod those locations are on the shell's path-the
> places it look s when you don't specify the full path of a program. On
> Windows, user-installed programs don't typically get put on the path.
> Check the path to make sure the directory is on there. It's probably a
> similar issue with pyflakes- you didn't put the file in the place
> where flatmate looks for it.
>
> > Thanks for your comments
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
>


Thanks for your reply, Ben. Actually I have the paths "C:\Python25;C:
\Python25\Scripts" in the %PATH% variable, and the %PYTHONPATH% has
the following:

C:\Python25\Lib\site-packages\pyflakes;C:\Python25\Lib\site-packages
\Pymacs;C:\Python25\Lib\site-packages\rope;C:\Python25\Lib\site-
packages\ropemacs;C:\Python25\Lib\site-packages\ropemode

Pymacs, rope, ropemacs, ropemode all work in Emacs, except pyflakes.

Looking at the file C:\Python25\Lib\site-packages\pyflakes-0.4.0-
py2.5.egg\EGG-INFO\scripts\pyflakes, it shows


#!C:\Python25\python.exe

from pyflakes.scripts.pyflakes import main
main()


So this script needs to trigger Python interpreter to run. I can
successfully run pyflakes by manually triggering Python like this:

C:\>python C:\Python25\Lib\site-packages\pyflakes-0.4.0-py2.5.egg\EGG-
INFO\scripts\pyflakes   test_new_lib.py
test_new_lib.py:13: invalid syntax
sa.CoreObj.



So pyflakes is running correctly. But it seems Emacs treats pyflakes
as an executable program instead of Python script. I include the
following in my .emacs file for pyflakes:



;;===== PyFlakes
;; code checking via pyflakes+flymake

(when (load "flymake" t)
 (defun flymake-pyflakes-init ()
 (let* ((temp-file (flymake-init-create-temp-buffer-copy
 'flymake-create-temp-inplace))
 (local-file (file-relative-name
 temp-file
 (file-name-directory buffer-file-name))))
 (list "pyflakes" (list local-file))))

 (add-to-list 'flymake-allowed-file-name-masks
 '("\\.py\\'" flymake-pyflakes-init)))

(add-hook 'find-file-hook 'flymake-find-file-hook)



What should I do to configure Emacs to make pyflakes working? Thank
you!



More information about the Python-list mailing list