我正在尝试在 Windows XP 上将 Pylint 与 Emacs 一起使用。我的 Emacs 版本是 EmacsW32 23.1,pylint 是 0.21.3 和 Python 2.5。在 easy_install pylint 之后,我在 Emacs 初始化文件中添加了以下几行,从 Emacs Wiki 复制。
当我在 .py 文件上调用 flymake-mode 时,我可以看到 flymake 开始语法检查,模式状态更改为 flymake*,然后在几秒钟后返回 flymake。但是没有报错,也没有语法错误高亮。
我尝试在命令行中使用 pylint,它与命令 "pylint test.py" 一起使用,报告同一文件上的语法错误。
我什至试图清除我的 .emacs 文件,但它没有帮助。
有人可以帮我吗?非常感谢。
(when (load "flymake" t) (defun flymake-pylint-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 "epylint" (list local-file)))) (add-to-list 'flymake-allowed-file-name-masks '("\\.py\\'" flymake-pylint-init)))
问题更新: 我在命令行提示符下使用“pylint”和“epylint”尝试了以下操作。这是否意味着epylint有问题?
C:\Projects>pylint test_lib.py No config file found, using default configuration ************* Module test_lib E: 13: invalid syntax C:\Projects>epylint test_lib.py 'test_lib.py':1: [F] No module named 'test_lib.py' C:\Projects>epylint Traceback (most recent call last): File "C:\Python25\Scripts\epylint", line 5, in <module> pkg_resources.run_script('pylint==0.21.3', 'epylint') File "C:\Python25\Lib\site-packages\pkg_resources.py", line 489, in run_script self.require(requires)[0].run_script(script_name, ns) File "C:\Python25\Lib\site-packages\pkg_resources.py", line 1207, in run_script execfile(script_filename, namespace, namespace) File "c:\python25\lib\site-packages\pylint-0.21.3-py2.5.egg\EGG-INFO\scripts\epylint", line 3, in <module> epylint.Run() File "c:\python25\lib\site-packages\pylint-0.21.3-py2.5.egg\pylint\epylint.py", line 93, in Run lint(sys.argv[1]) IndexError: list index out of range