在ubuntu14.04上使用gnomekeyring模块和Python和GTK3

2024-09-28 21:52:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是基于Ubuntu14.04的LinuxMint17

我安装了:

  • python gnomekeyring 2.3.2\
  • python gi 3.12版
  • python-gtk2 2.24版

我有以下脚本:

#!/usr/bin/python

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import gnomekeyring

但我得到一个错误:

/usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed import gobject._gobject

我能做些什么来修复这个?在

编辑: Get attributes of GnomeKeyring key with Python 2.7 GTK3 on Ubuntu 14.04


Tags: namefromimport脚本gtkbinversionusr
1条回答
网友
1楼 · 发布于 2024-09-28 21:52:49

python gnomekeyring使用Gtk+2,不能在与Gtk+3相同的进程中使用。在

您应该能够使用GnomeKeyring-1.0地理信息库公司名称:

import gi
gi.require_version('Gtk', '3.0')
gi.require_version('GnomeKeyring', '1.0')

from gi.repository import Gtk, GnomeKeyring

正如oxideworks在评论中指出的,当前的GnomeKeyring已经将它的所有API标记为弃用:libsecrets“Secret”D-busapi(在GNOME上由GnomeKeyring提供)应该能够做同样的事情。在

这里有一个Python API reference,但是规范引用有一些python examples以及关于从gnome keyring迁移的建议,但是要注意,后者将主要讨论C API。在

相关问题 更多 >