【问题标题】:Pychecker index error on first run首次运行时 Pychecker 索引错误
【发布时间】:2016-07-07 08:03:09
【问题描述】:

我刚刚使用“python setup.py install”在 Windows 7 Pro 上安装了 pychecker。当我使用命令在我的脚本上运行它时:

c:\Python26\Scripts\pychecker -#100 finaltest17.py

我收到以下错误/回溯:

C:\Users\....\ToBeReleased>C:\Python26\python.exe C:\Python26\Lib\site-packages\pychecker\checker.py -#100 finaltest17.py
Processing module finaltest17 (finaltest17.py)...
  Caught exception importing module finaltest17:
    File "C:\Python26\Lib\site-packages\pychecker\pcmodules.py", line 533, in setupMainCode()
      self.moduleName, self.moduleDir)
    File "C:\Python26\Lib\site-packages\pychecker\pychecker\utils.py", line 184, in findModule()
      handle, filename, smt = _q_find_module(p, path)
    File "C:\Python26\Lib\site-packages\pychecker\pychecker\utils.py", line 162, in _q_find_module()
      if not cfg().quixote:
    File "C:\Python26\Lib\site-packages\pychecker\pychecker\utils.py", line 39, in cfg()
      return _cfg[-1]
  IndexError: list index out of range
Traceback (most recent call last):
  File "C:\Python26\Lib\site-packages\pychecker\checker.py", line 364, in <module>
    sys.exit(main(sys.argv))
  File "C:\Python26\Lib\site-packages\pychecker\checker.py", line 337, in main
    importWarnings = processFiles(files, _cfg, _print_processing)
  File "C:\Python26\Lib\site-packages\pychecker\checker.py", line 270, in processFiles
    loaded = pcmodule.load()
  File "C:\Python26\Lib\site-packages\pychecker\pcmodules.py", line 477, in load

    return utils.cfg().ignoreImportErrors
  File "C:\Python26\Lib\site-packages\pychecker\pychecker\utils.py", line 39, in cfg
    return _cfg[-1]
IndexError: list index out of range

如果有人能指出我正确的方向,那就太好了。

谢谢

斯图尔特

【问题讨论】:

  • 您说您执行的命令与错误回溯中显示的命令不同。请发布正确的输出。
  • 错误回溯对于我运行的命令是正确的。当我运行“Python26\Scripts\pychecker -#100 finaltest17.py”时,pychecker 所做的第一件事就是将命令运行为“C:\Python26\python.exe C:\Python26\Lib\site-packages\pychecker\checker .py -#100 finaltest17.py"
  • 你说你运行的命令是c:\Python26\Scripts\pychecker -#100 finaltest17.py,但在输出中,推荐是C:\Python26\python.exe C:\Python26\Lib\site-packages\pychecker\checker.py -#100 finaltest17.py——不是一回事。
  • 在 windows 中“Python26\Scripts\pychecker”是一个 bat 文件,它调用显式形式“Python26\Lib\site-packages\pychecker\checker.py”

标签: python python-2.6 pychecker


【解决方案1】:

问题已解决。 我在 SourceForge 上找到了以下支持请求,它指的是需要在 pychecker.bat 中使用短格式(8.3)路径和文件名,而不是较新版本的 Windows 中允许的长格式。 https://sourceforge.net/p/pychecker/support-requests/7/#96cb

【讨论】:

  • pychecker.py 的内容应该是:C:\Python26\python.exe C:\Python26\Lib\site-p~1\pychec~1\checker.py %* 而不是 " C:\Python26\python.exe C:\Python26\Lib\site-packages\pychecker\checker.py %*
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-01-22
  • 1970-01-01
  • 2019-06-02
  • 1970-01-01
  • 2017-12-21
相关资源
最近更新 更多