【问题标题】:JSONDecodeError Poetry (Python 3.10)JSONDecodeError 诗歌 (Python 3.10)
【发布时间】:2022-07-22 20:06:08
【问题描述】:

问题

自从我从 Python 3.8 迁移到 Python 3.10 后,我在任何 GitHub 运行器上的 CI/CD 管道 (Github Actions) 中使用 poetry install 时遇到问题。

Installing dependencies from lock file

Package operations: 79 installs, 0 updates, 0 removals
  • Installing pyparsing (3.0.9)
  
JSONDecodeError
  
Expecting value: line 1 column 1 (char 0)
  at /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/json/decoder.py:355 in raw_decode
      351│         """
      352│         try:
      353│             obj, end = self.scan_once(s, idx)
      354│         except StopIteration as err:
    → 355│             raise JSONDecodeError("Expecting value", s, err.value) from None
      356│         return obj, end
      357│ 
Error: Process completed with exit code 1.

我没有更改 pyproject.toml 文件中的任何 lib 配置,但正如您在上面看到的:Poetry 隐藏了 StackTrace 的大部分内容。

我尝试了什么

  • 重新创建 poetry.lock 文件。
  • 使用rm -r ~/.cache/pypoetry/cache/(和rm -r ~/.cache/pypoetry/)删除诗歌缓存。
  • 删除什么返回错误的库(实际上,这个问题似乎发生在任何库上,所以这就是我理解它可能与诗歌和 python 有关的原因)

问题

知道如何在我的 CI/CD 管道中解决此问题吗?

【问题讨论】:

    标签: github-actions python-3.10 poetry


    【解决方案1】:

    经过一番研究,我从 2021 年 11 月开始在诗歌 GitHub 存储库上找到了this thread

    在这里,hoefling GitHub user 提供了这个解决方法:

    禁用诗歌的实验性新安装程序可能是一种解决方法 现在:

    解决方案

    poetry config experimental.new-installer false
    

    在运行 poetry install 命令之前在 shell 中添加这一行解决了我的问题!



    请注意,在同一线程中,ddc67cd 的另一条评论指出:

    新版本的 cachecontrol==0.12.9 解决了该问题(应该会自动安装)。

    但运行pip install -U cachecontrol 并没有解决我的具体情况下的问题(否则可能值得测试?)。

    【讨论】:

      猜你喜欢
      • 2022-11-02
      • 1970-01-01
      • 1970-01-01
      • 2019-05-18
      • 1970-01-01
      • 1970-01-01
      • 2020-02-15
      • 2022-07-14
      • 1970-01-01
      相关资源
      最近更新 更多