Python Alarm Clock 0

A Simple Python Alarm Clock 05/05/11

Problem: You are all alone in a far away land and needed to wake up early the next day. The problem is, you forgot to bring any alarm clock. But, ...


Python Alarm Clock

Python Alarm Clock

Problem: You are all alone in a far away land and needed to wake up early the next day. The problem is, you forgot to bring any alarm clock. But, you brought a Linux-powered laptop computer with you. Say for example an Asus Eee PC.

 

Solution: Most Linux distributions have Python installed out-of-the-box. All you need is this very simple Python alarm clock script:

import time
import os

not_executed = 1

while(not_executed):
dt = list(time.localtime())
hour = dt[3]
minute = dt[4]
if hour == 5 and minute == 45:
os.popen2(“open /Users/jun/shout.mp3″)
not_executed = 0

Happy Hacking! :)

Related posts:


You can leave a response, or trackback from your own site.

Leave a Reply

close comment popup

Leave A Reply