A text-based countdown script in Python

Problem: You want to count down to an event (e.g., a rocket launch). But the web-based animated countdown consumes too much screen space and battery power (i.e., your laptop’s fan turns on when you go to that web page).

Solution: a text-based countdown in a small shell or console window. This one, down.py, is written in Python 3. The project on GitHub is called DownPy.

I’ve tested this on Linux (Ubuntu 12.04) and Mac OS X Mavericks (10.9). It has no fancy appearance, and all it does is count down.  But that’s also why it barely takes any power.

If you want to try this in the next few days, here is an example.  This the command for counting down to the currently scheduled launch time of NASA’s Orbiting Carbon Observatory (OCO-2).

./down.py 2014-07-01 02:56 -z -7:00

If you’re a git user, then you should know how to clone the DownPy project. And if you aren’t, there is really only a single file. Make sure you have Python 3, copy the file, make it executable, and go for it!  Of course, you can also open multiple shell/command windows, and have a countdown for each different event you are interested in. (There are some Mars spacecraft encounters coming up.)

So now you how I spent one day of my weekend.  I came up with the basic date/time queries in Python earlier in the week. Then on the weekend, I created a loop that adjusts to lag and other compute load oddities.  By the evening, I had it reporting and rewriting on a single, non-scrolling line.

[More info on Python, including downloads.]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s