Big thanks slarti! I couldn't get it to work by simply adding import sys at the top too. So what about the syntax errors?
python myscript.py
Yeah! Now I got the picture about the special chars in python. Works great.
Almost done now, just get rid of the 'No alarms' msg in a way that the line in BB disappears (and won't leave a blank line), if there's no alarm. Add the second alarm probably?
Edit: I'm already using your script for short weekday, could this be implemented in the above script to adopt to my language? I prefer short weekday very much over the "+1" from {events}, good idea!
#!/usr/bin/python import dbus from datetime import datetime, timedelta import time bus = dbus.SystemBus() time_obj = bus.get_object('com.nokia.time', '/com/nokia/time') time_intf = dbus.Interface(time_obj, 'com.nokia.time') cookies = time_intf.get_cookies_by_attributes({'enabled': '1'}) today = datetime.now() tomorrow = today + timedelta(days=1) def list_queued_alarms(): for cookie in cookies: attributes = time_intf.query_attributes(cookie) alarmtime = attributes['alarmtime'] if attributes['STATE'] == 'QUEUED': if 'recurrence' in attributes: days = tuple(attributes['recurrence']) else: if datetime.time(datetime.strptime(alarmtime, ("%H:%M"))) > datetime.time(datetime.now()): days = time.strftime("%w") else: days = tomorrow.strftime("%w") weekdays = dict([(day, time.strptime((day + " " + alarmtime),'%w %H:%M' )) for day in days]) for day in days: yield ' '.join((day,time.strftime('%H:%M',weekdays[day]),attributes['TITLE'])) findme_list = [' '.join((time.strftime('%w %H:%M'),'findme'))] L = list(list_queued_alarms()) + findme_list L.sort() findme_string = ' '.join((time.strftime('%w %H:%M'),'findme')) findme_int = L.index(findme_string) if len(L) == 1: pass else: if findme_int == (len(L) - 1): next_alarm = L[0] else: next_alarm = L[findme_int + 1] abb_weekdays = ['Su','Ma','Ti','Ke','To','Pe','La'] next_alarm_list = next_alarm.split(' ' ,1) print ' '.join((abb_weekdays[int(next_alarm_list[0])],next_alarm_list[1])).encode('utf-8') + '\xe2\x98\x9a'