运行诗歌安装时的 DBusErrorResponse

Emi*_*aas 8 python python-poetry

我尝试将我的诗歌从 1.1.x 版本升级到 1.3,但官方手册(https://python-poetry.org/docs/)建议我手动删除旧版本。不幸的是,我可能删除了错误的文件,因为安装 1.3 版本后,我仍然收到错误,这些错误似乎与旧诗歌相冲突。 \n我试图找到我帐户中的所有文件(它是远程计算机,所以我不想影响其他人)以某种方式与诗歌(与find /home/username -name *poetry*)有联系并且(卸载诗歌1.3后)删除了它们。然后我重新安装了诗歌 1.3,但仍然无法正常工作。\n还尝试删除我的整个存储库并再次克隆它,但仍然存在同样的问题。我想我已经很生气了,但希望有某种方法可以进行硬重置。有什么办法可以摆脱这个吗?

\n

这是我的错误消息的开头:

\n
\nPackage operations: 28 installs, 0 updates, 0 removals\n\n  \xe2\x80\xa2 Installing certifi (2021.10.8)\n  \xe2\x80\xa2 Installing charset-normalizer (2.0.12)\n  \xe2\x80\xa2 Installing idna (3.3)\n  \xe2\x80\xa2 Installing six (1.16.0)\n  \xe2\x80\xa2 Installing typing-extensions (4.2.0)\n  \xe2\x80\xa2 Installing urllib3 (1.26.9)\n\n  DBusErrorResponse\n\n  [org.freedesktop.DBus.Error.UnknownMethod] (\'No such interface \xe2\x80\x9corg.freedesktop.DBus.Properties\xe2\x80\x9d on object at path /org/freedesktop/secrets/collection/login\',)\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply\n       44\xe2\x94\x82     def send_and_get_reply(self, msg: Message) -> Any:\n       45\xe2\x94\x82         try:\n       46\xe2\x94\x82             resp_msg: Message = self._connection.send_and_get_reply(msg)\n       47\xe2\x94\x82             if resp_msg.header.message_type == MessageType.error:\n    \xe2\x86\x92  48\xe2\x94\x82                 raise DBusErrorResponse(resp_msg)\n       49\xe2\x94\x82             return resp_msg.body\n       50\xe2\x94\x82         except DBusErrorResponse as resp:\n       51\xe2\x94\x82             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):\n       52\xe2\x94\x82                 raise ItemNotFoundException(\'Item does not exist!\') from resp\n\nThe following error occurred when trying to handle this error:\n\n\n  ItemNotFoundException\n\n  Item does not exist!\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply\n       48\xe2\x94\x82                 raise DBusErrorResponse(resp_msg)\n       49\xe2\x94\x82             return resp_msg.body\n       50\xe2\x94\x82         except DBusErrorResponse as resp:\n       51\xe2\x94\x82             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):\n    \xe2\x86\x92  52\xe2\x94\x82                 raise ItemNotFoundException(\'Item does not exist!\') from resp\n       53\xe2\x94\x82             elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,\n       54\xe2\x94\x82                                DBUS_NO_REPLY):\n       55\xe2\x94\x82                 data = resp.data\n       56\xe2\x94\x82                 if isinstance(data, tuple):\n\nThe following error occurred when trying to handle this error:\n\n\n  PromptDismissedException\n\n  Prompt dismissed.\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection\n      155\xe2\x94\x82     if len(collection_path) > 1:\n      156\xe2\x94\x82         return Collection(connection, collection_path, session=session)\n      157\xe2\x94\x82     dismissed, result = exec_prompt(connection, prompt)\n      158\xe2\x94\x82     if dismissed:\n    \xe2\x86\x92 159\xe2\x94\x82         raise PromptDismissedException(\'Prompt dismissed.\')\n      160\xe2\x94\x82     signature, collection_path = result\n      161\xe2\x94\x82     assert signature == \'o\'\n      162\xe2\x94\x82     return Collection(connection, collection_path, session=session)\n      163\xe2\x94\x82 \n\nThe following error occurred when trying to handle this error:\n\n\n  InitError\n\n  Failed to create the collection: Prompt dismissed..\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/backends/SecretService.py:63 in get_preferred_collection\n       59\xe2\x94\x82                 collection = secretstorage.Collection(bus, self.preferred_collection)\n       60\xe2\x94\x82             else:\n       61\xe2\x94\x82                 collection = secretstorage.get_default_collection(bus)\n       62\xe2\x94\x82         except exceptions.SecretStorageException as e:\n    \xe2\x86\x92  63\xe2\x94\x82             raise InitError("Failed to create the collection: %s." % e)\n       64\xe2\x94\x82         if collection.is_locked():\n       65\xe2\x94\x82             collection.unlock()\n       66\xe2\x94\x82             if collection.is_locked():  # User dismissed the prompt\n       67\xe2\x94\x82                 raise KeyringLocked("Failed to unlock the collection!")\n\n\n  DBusErrorResponse\n\n  [org.freedesktop.DBus.Error.UnknownMethod] (\'No such interface \xe2\x80\x9corg.freedesktop.DBus.Properties\xe2\x80\x9d on object at path /org/freedesktop/secrets/collection/login\',)\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply\n       44\xe2\x94\x82     def send_and_get_reply(self, msg: Message) -> Any:\n       45\xe2\x94\x82         try:\n       46\xe2\x94\x82             resp_msg: Message = self._connection.send_and_get_reply(msg)\n       47\xe2\x94\x82             if resp_msg.header.message_type == MessageType.error:\n    \xe2\x86\x92  48\xe2\x94\x82                 raise DBusErrorResponse(resp_msg)\n       49\xe2\x94\x82             return resp_msg.body\n       50\xe2\x94\x82         except DBusErrorResponse as resp:\n       51\xe2\x94\x82             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):\n       52\xe2\x94\x82                 raise ItemNotFoundException(\'Item does not exist!\') from resp\n\nThe following error occurred when trying to handle this error:\n\n\n  ItemNotFoundException\n\n  Item does not exist!\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply\n       48\xe2\x94\x82                 raise DBusErrorResponse(resp_msg)\n       49\xe2\x94\x82             return resp_msg.body\n       50\xe2\x94\x82         except DBusErrorResponse as resp:\n       51\xe2\x94\x82             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):\n    \xe2\x86\x92  52\xe2\x94\x82                 raise ItemNotFoundException(\'Item does not exist!\') from resp\n       53\xe2\x94\x82             elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,\n       54\xe2\x94\x82                                DBUS_NO_REPLY):\n       55\xe2\x94\x82                 data = resp.data\n       56\xe2\x94\x82                 if isinstance(data, tuple):\n\nThe following error occurred when trying to handle this error:\n\n\n  PromptDismissedException\n\n  Prompt dismissed.\n\n  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection\n      155\xe2\x94\x82     if len(collection_path) > 1:\n      156\xe2\x94\x82         return Collection(connection, collection_path, session=session)\n      157\xe2\x94\x82     dismissed, result = exec_prompt(connection, prompt)\n      158\xe2\x94\x82     if dismissed:\n    \xe2\x86\x92 159\xe2\x94\x82         raise PromptDismissedException(\'Prompt dismissed.\')\n      160\xe2\x94\x82     signature, collection_path = result\n      161\xe2\x94\x82     assert signature == \'o\'\n      162\xe2\x94\x82     return Collection(connection, collection_path, session=session)\n      163\xe2\x94\x82 \n\n
Run Code Online (Sandbox Code Playgroud)\n

Emi*_*aas 17

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

有几种方法可以做到这一点:

  1. 在 shell 中运行export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring将适用于以下诗歌命令,直到您关闭(退出) shell 会话

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

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

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

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

对于情况 3)您现在可以照常运行任何诗歌命令,即使在系统重新启动后也是如此