I checked for DBUS_SESSION_BUS_ADDRESS, as Markus suggested, as well as DISPLAY. Benji did a bit of experimentation to show that it was possible to have the DBUS_SESSION_BUS_ADDRESS but not DISPLAY, and we believe that it is correct in that case to not try to work with the Gnome keyring.
I've made a fix in the python keyring.
https:/ /bitbucket. org/kang/ python- keyring- lib/pull- request/ 3/do-not- try-to- connect- to-the- gnome-keyring
I checked for DBUS_SESSION_ BUS_ADDRESS, as Markus suggested, as well as DISPLAY. Benji did a bit of experimentation to show that it was possible to have the DBUS_SESSION_ BUS_ADDRESS but not DISPLAY, and we believe that it is correct in that case to not try to work with the Gnome keyring.