[tomboy-list] need help debugging my little dbus script

Pedro pedro100 at gmail.com
Tue Sep 16 08:43:47 PDT 2008

I noticed recently that  this script has a bug. If the note doesn't
exist t just gets created but the contents are left blank. A work
around is running this script twice, but can anybody tell me why does
the "Note Index" note gets created but its content is left blank?

In case the indentation is lost please check  pastebin link

#!/usr/bin/env python
#   This script creates a tomboy note containing link to each other note
#   so one can easily export all the notes to an HTML file

import dbus, time

note_title = "Note Index"

# Get the D-Bus session bus
bus = dbus.SessionBus()

# Access the Tomboy D-Bus object
obj = bus.get_object("org.gnome.Tomboy","/org/gnome/Tomboy/RemoteControl")

# Access the Tomboy remote control interface
tomboy = dbus.Interface(obj, "org.gnome.Tomboy.RemoteControl")

notes_links = ""

for note in tomboy.ListAllNotes():
	notes_links += tomboy.GetNoteTitle(note) + " \n"

uri = tomboy.FindNote(note_title)
if uri == "":
	uri = tomboy.CreateNamedNote(note_title)

tomboy.SetNoteContents(uri, note_title + "\n\n" + notes_links)

More information about the Tomboy-list mailing list