I try to use SecretStorage in two Python processes, but when I try to update my Gtk.Window, I get this message most of the time:
RuntimeError: unable to initialize SecretService: did not receive a Reply. Possible reasons: the remote application did not send a response, the message bus security policy blocked the response, the response timeout expired, or the network connection was broken.
Both started with multiprocessing.Process , this works:
def get_data(self):
p1 = Process(target=P1().update_database)
p1.start()
p1.join()
p2 = Process(target=P2().update_database)
p2.start()
p2.join()
The problem is that it blocks my Gtk interface, the window is locked, other buttons are not available.
Because of this, I also used threading.Thread
def on_get_data_button_clicked(self, widget):
thread = Thread(target=self.get_data)
thread.start()
, , .
, Gtk.Spinner-Button
def on_get_data_button_clicked(self, widget):
thread = Thread(target=self.get_data)
thread.start()
GObject.timeout_add(200, self.manage_spinner, thread)
def manage_spinner(self, thread):
if thread.is_alive():
return True
else:
self.sync_spinner.stop()
return False
, :
RuntimeError: SecretService: . : , , , .
SecretStorage :
def get_key(self, key_name):
bus = secretstorage.dbus_init()
collection = secretstorage.get_default_collection(bus)
if collection.is_locked():
collection.unlock()
items = collection.get_all_items()
for item in items:
if item.get_label() == key_name:
return item.get_secret()
, get_key() GObject.timeout_add.
, , : secretstorage