I am feeling very happy today.
About three or four weekends back, I discovered Python. I mean I knew about it and all that but never had written code in it. In fact, I remember, when I was toying around with RedHat Kickstart way back in 2001, I used to get hit by these Traceback messages and to me they looked a tad ugly. And I never had the desire to learn Python. In the meantime, I picked up Ruby and Perl, and they served me well enough.
Sometime ago, I had a personal itch. Backing up my data. You know, I tried quite a few of these backup programs and each had its own set of things that irked me. I wanted something very simple. A program that will figure out the files that have changed since the last backup and just copy them over. Simple !
I knew there were things I did not need (at least to start with)
- I dont need fancy GUI, I can handle cmdline.
- I do not need no two-way syncronization, I do not need restore capability. I can manually copy back what I need in case of a disaster
- I do not need encryption
The professional programs were an overkill for what I needed and the good ones were not free.
So I started writing an incremental backup program in Ruby. Here’s the beautiful post from that day, April 6. I usually get to code only on weekends (my day job is less adventurous ;-). But after a few weekends, I found myself getting back to the Ruby code that I wrote and having to relearn/re-remember everything. the syntax, the flow, why I did those nifty tricks that I did. In short, I was taking three steps forward and two back.
I would love to, but I do not remember exactly what was the thought in my head that provoked me to google “Python”. But I am happy that I did.
I downloaded the Windows version (at that time I was unaware of the 2.7 versus 3.0 line split) – so I happily took the “latest” — Python 3.2. Then I looked around for some tutorials and came across something up on Google Code. It’s a very nicely-put tutorial that mixes a bunch of exercises with some lesson notes to give you a hands-on experience. (It still respect the 2.x line, so it took me a while to figure out why the ‘print’ statement does not work). Another online book that I found helpful was Mark Pilgrim’s DiveIntoPython ( and later, DIP 3)
I started liking the language. The syntax seemed to make sense. The indentation auto-beautified the code. The indentation-based blocking reminded me of my Masters thesis where I was introduced to this language called occam. After many years, I was able to express myself fluently in a programming language (no I do not want to sound epiphanic). It gave me a high.
Well, the Traceback messages still looked ugly.
Then I had this idea to port my Ruby program to Python. The name “backrub” did not make sense anymore (A few days later I came to know that backrub was the name of the first version of the google search engine !). So I started calling it backpyper (I don’t like the name so much). I could see myself making faster progress. The language helped; it was easy enough to learn the basics. It had a self-propelling effect — since it was fun, I was spending more time on it. But most importantly, when I looked back at the code, I could easily figure what it said !
<quote> Isn’t it fun to have a neat handwriting that you can yourself read ? </quote>
It was not without its share of woes. I ended up tanking a whole directory worth of files, by overwriting them with 1 KB plaintext files (an error in the destination string). Luckily I got the needed ones back !
So finally, after about 3 weekends, I have something that works. It works only on my computer for now; hardcoded stuff and all. But it works ! And works nicely – with DOS based progressbar kind of things !
An incremental backup takes only about 10 minutes and that too because my .pst files are huge. I am trying to do something about it.
I am having fun learning Python. And I am really happy that I could, after a long time, use a self-authored computer program to scratch a personal itch.