February 4, 2010

The Joys of Linux

I'm taking a course on Python this semester. I'm really excited about it; there really is no other word for it. I'm sure that my excitement over something as simple as, say, simultaneous assignment, won't be easily conveyed to non-programmers or even anyone besides myself. Nevertheless, the new toys in Python, and particularly the new paradigms (I have never dabbled in functional programming before now, but the potentials offered by yield and generators are making me positively giddy), are very exciting.
The course is just now migrating to Python 3, so in a sense it's good that I didn't get started with the language until now. Unfortunately the default Python documentation (http://docs.python.org/) is for 2.6.4, so it's very easy to get tripped up by outdated information. In a yet more sinister turn, Ubuntu itself uses 2.6 by default! I didn't think this was much of a problem at first. A bit of Googling eventually schooled me in the proper use of update-alternatives, and soon I had set the default python command to call python3. But then the problems came.
The first sign I had that something was wrong was a big red "do not enter"-style notification at the top right, telling me that the update manager wasn't working. I won't go into the details, but I tried all I could to fix it, and somehow I fooled around with dpkg to the extent that GRUB now displayed my install as "Debian". I had all but given up, and I was on the verge of reinstalling, when I booted up today and realized that Dropbox wasn't running, either. Running dropbox in a terminal gave me some strange error, which seemed to hint that the contents of the file were text, not the binary executable itself. So, on a hunch, I opened up /usr/bin/dropbox in a text editor, and what do I see?
#!/usr/bin/python
The dropbox script was formatted for Python 2.x (it was Unicode strings causing this particular error), and my messing around with the default python command was what caused my problems. Evidently the update manager also relied on Python, because resetting the default command back to 2.6 allowed the update manager to run again, and at the moment it looks like everything's going to be okay.

UPDATE: Everything was not okay.

No comments:

Post a Comment