python - tox 始终返回 "dictionary changed size during iteration"

标签 python tox

我全新安装了 tox,它总是返回“RuntimeError:字典在迭代期间更改了大小”。即使在没有参数的情况下运行它也是如此。当它尝试从 pyparsing 导入内容时,它看起来失败了。任何帮助将不胜感激。

我在 Python 3.7.3 下的 MacOS 上运行 tox 3.20.0。

这是完整的堆栈跟踪:

(py37) thisuser$ tox
Traceback (most recent call last):
  File "/Users/thisuser/.virtualenvs/py37/bin/tox", line 5, in <module>
    from tox import cmdline
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/tox/__init__.py", line 32, in <module>
    from .session import cmdline  # isort:skip
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/tox/session/__init__.py", line 22, in <module>
    from tox.config import INTERRUPT_TIMEOUT, SUICIDE_TIMEOUT, TERMINATE_TIMEOUT, parseconfig
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/tox/config/__init__.py", line 21, in <module>
    from packaging import requirements
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/packaging/requirements.py", line 9, in <module>
    from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/pyparsing.py", line 4909, in <module>
    _escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/pyparsing.py", line 1294, in setParseAction
    self.parseAction = list(map(_trim_arity, list(fns)))
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/pyparsing.py", line 1076, in _trim_arity
    this_line = extract_stack(limit=2)[-1]
  File "/Users/thisuser/.virtualenvs/py37/lib/python3.7/site-packages/pyparsing.py", line 1060, in extract_stack
    frame_summary = traceback.extract_stack(limit=-offset+limit-1)[offset]
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 211, in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 363, in extract
    f.line
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/traceback.py", line 285, in line
    self._line = linecache.getline(self.filename, self.lineno).strip()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py", line 16, in getline
    lines = getlines(filename, module_globals)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py", line 48, in getlines
    for mod in sys.modules.values():
RuntimeError: dictionary changed size during iteration

最佳答案

我在使用 Mac OS 默认 Python 版本 (3.7.3) 时遇到了同样的问题。我检查了 tox.ini 文件,看到了一些对 py36 的引用,因此我使用 pyenv 切换到 Python 3.6.9。这为我修复了 RuntimeError:dictionarychanged size during iteration 错误,并且所有测试均已成功触发。

关于python - tox 始终返回 "dictionary changed size during iteration",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64164592/

相关文章:

python - 如何用python获取选择区域坐标?

python pandas 简单数据透视表总和计数

python - 如何使用 Tox 和 Poetry 在 CircleCI 中设置多个解释器?

python - tox 环境如何设置其 sys.path

python - 使用 Tox 和 Teamcity 测试 python 项目

python - 将 PyQt5 与 Tox(Python3.4 和 Python3.5)一起使用

python - 在 python 中嵌套拆分括号的快速方法是什么?

文本标签中的 python、matplotlib、svg 和超链接

python - 在 Vagrant 中访问端口 5000 时遇到问题

python - 结合 tox 为 Travis CI 指定确切的 Python 版本