在运行poetry install时出现了DBusErrorResponse。

7

我尝试将我的诗歌从1.1.x版本升级到1.3版本,但正如官方手册(https://python-poetry.org/docs/)建议的那样,我手动删除了旧版本。不幸的是,我可能删除了错误的文件,因为在安装1.3版本后,我仍然收到错误提示,似乎与旧诗歌有冲突。

我尝试使用find /home/username -name *poetry*查找与诗歌相关的所有文件(这是一个远程机器,所以我不想影响其他人),并在卸载诗歌1.3后将它们删除。然后我重新安装了诗歌1.3,但仍然无法正常工作。

我还尝试删除整个存储库并再次克隆它,但问题仍然存在。我想我已经搞砸了,但希望有一些方法可以进行硬重置。有没有办法解决这个问题?

以下是我的错误消息开头:


Package operations: 28 installs, 0 updates, 0 removals

  • Installing certifi (2021.10.8)
  • Installing charset-normalizer (2.0.12)
  • Installing idna (3.3)
  • Installing six (1.16.0)
  • Installing typing-extensions (4.2.0)
  • Installing urllib3 (1.26.9)

  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login',)

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44def send_and_get_reply(self, msg: Message) -> Any:
       45try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47if resp_msg.header.message_type == MessageType.error:
    →  48raise DBusErrorResponse(resp_msg)
       49return resp_msg.body
       50except DBusErrorResponse as resp:
       51if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52raise ItemNotFoundException('Item does not exist!') from resp

The following error occurred when trying to handle this error:


  ItemNotFoundException

  Item does not exist!

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply
       48raise DBusErrorResponse(resp_msg)
       49return resp_msg.body
       50except DBusErrorResponse as resp:
       51if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  52raise ItemNotFoundException('Item does not exist!') from resp
       53elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       54│                                DBUS_NO_REPLY):
       55│                 data = resp.data
       56if isinstance(data, tuple):

The following error occurred when trying to handle this error:


  PromptDismissedException

  Prompt dismissed.

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection
      155if len(collection_path) > 1:
      156return Collection(connection, collection_path, session=session)
      157│     dismissed, result = exec_prompt(connection, prompt)
      158if dismissed:
    → 159raise PromptDismissedException('Prompt dismissed.')
      160│     signature, collection_path = result
      161assert signature == 'o'
      162return Collection(connection, collection_path, session=session)
      163│ 

The following error occurred when trying to handle this error:


  InitError

  Failed to create the collection: Prompt dismissed..

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/backends/SecretService.py:63 in get_preferred_collection
       59│                 collection = secretstorage.Collection(bus, self.preferred_collection)
       60else:
       61│                 collection = secretstorage.get_default_collection(bus)
       62except exceptions.SecretStorageException as e:
    →  63raise InitError("Failed to create the collection: %s." % e)
       64if collection.is_locked():
       65│             collection.unlock()
       66if collection.is_locked():  # User dismissed the prompt
       67raise KeyringLocked("Failed to unlock the collection!")


  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login',)

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44def send_and_get_reply(self, msg: Message) -> Any:
       45try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47if resp_msg.header.message_type == MessageType.error:
    →  48raise DBusErrorResponse(resp_msg)
       49return resp_msg.body
       50except DBusErrorResponse as resp:
       51if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52raise ItemNotFoundException('Item does not exist!') from resp

The following error occurred when trying to handle this error:


  ItemNotFoundException

  Item does not exist!

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply
       48raise DBusErrorResponse(resp_msg)
       49return resp_msg.body
       50except DBusErrorResponse as resp:
       51if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  52raise ItemNotFoundException('Item does not exist!') from resp
       53elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       54│                                DBUS_NO_REPLY):
       55│                 data = resp.data
       56if isinstance(data, tuple):

The following error occurred when trying to handle this error:


  PromptDismissedException

  Prompt dismissed.

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection
      155if len(collection_path) > 1:
      156return Collection(connection, collection_path, session=session)
      157│     dismissed, result = exec_prompt(connection, prompt)
      158if dismissed:
    → 159raise PromptDismissedException('Prompt dismissed.')
      160│     signature, collection_path = result
      161assert signature == 'o'
      162return Collection(connection, collection_path, session=session)
      163

你可能会在这个答案中找到一些线索:https://dev59.com/x1EG5IYBdhLWcg3wOXOV#70064450。 - Mikko Ohtamaa
1
我尝试了你们所有的建议,但不幸的是都没有帮助。 - Emil Haas
你知道什么是secretstorage以及为什么在运行Poetry时系统会尝试使用它吗? - Mikko Ohtamaa
因为这不是标准诗歌流程的一部分,而且这是我第一次看到它。 - Mikko Ohtamaa
我之前不知道secretstorage,但它似乎是一些辅助包。但我不确定它是为哪个包而需要的,而且在我的poetry.lock文件中也没有指定(当我在另一台之前未安装过poetry 1.1的电脑上尝试时,这不是问题)。 - Emil Haas
我编辑了我的错误信息 - 我将其开头添加到了问题中。实际上,我发现有人在这里遇到了相同的错误(https://github.com/python-poetry/poetry/issues/6558),但他只是被引用到了这里(https://github.com/python-poetry/poetry/issues/1917)。有一些提示可以设置PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring,但我不知道在哪里设置,也无法在那里询问。我尝试将其添加到某些配置文件中,但要么那不是我的情况,要么我使用了错误的配置... - Emil Haas
1个回答

16

最终我在这里找到了答案。

有几种方法可以实现:

  1. 在shell中运行export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring,可在关闭(退出)shell会话之前的poetry命令中使用

  2. 为每个!poetry命令添加环境变量,例如PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install

  3. 如果您想在shell会话或系统重新启动之间保留(存储)此环境变量,则可以将其添加到.bashrc.profile中 bash shell示例:

    echo 'export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring' >> ~/.bashrc

    echo 'export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring' >> ~/.profile exec "$SHELL"

对于第3种情况,您现在可以像往常一样运行任何poetry命令,即使在系统重新启动后也是如此。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接