当前位置:优学网  >  在线题库

从Windows凭据管理器读取凭据时引发密钥环

发表时间:2022-07-08 00:00:02 阅读:77

我试图在windows系统上实现keyring,以管理pyodbc和sqlalchemy中连接字符串的数据库密码.我已尝试确保已安装抛出的NameError中的相关软件包.

在windows上手动在keyring中设置后端的原因

这是我运行的代码:`

from keyring.backends import Windows
import keyring
keyring.set_keyring(Windows.WinVaultKeyring())
keyring.get_password("Service", "Username")

以下是引发的错误:

    Traceback (most recent call last):
  File ".\Python310\lib\site-packages\keyring\backends\Windows.py", line 109, in _get_password
    res = win32cred.CredRead(
NameError: name 'win32cred' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".\Python310\lib\site-packages\keyring\core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
  File ".\Python310\lib\site-packages\keyring\backends\Windows.py", line 99, in get_password
    res = self._get_password(service)
  File ".\Python310lib\site-packages\keyring\backends\Windows.py", line 112, in _get_password
    except pywintypes.error as e:
NameError: name 'pywintypes' is not defined

已安装的软件包如下所示:

星体2.9.3回传字符集归一化器2.0.12密码学执行fsspec 2022.5.0 idna 3.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.1.0.0.0.1.0.0.0.0.0.0.0.0d> 1.7.11.0.0mccabe0.6.1失谐22.3opencv python4.5.5.64包装21.3<0.7.5枕头9.1.1pip<22.1.2平台.9.53PyQt6-Qt6-sip Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseract Pyteseractd> python dateutil 2.8.2.2.0.4.0.4.pywinauto 0.2.0请求<Send2Trash.8.0设置工具2022.3.16火炬torchvision 0.12.0拖车网络编码0.5.1

🎖️ 优质答案
相关问题