Category Archives: Technology

Learn Python the Hard Way – Lesson 15

Mac Terminal Python Commands

I’m going through Zed Shaw’s online course Learn Python the Hard Way and I ran into a study drill that gave me some trouble.

In lesson 15 the seventh study drill is a little tricky if you’re not familiar with┬áthe command line. Instead of opening a Python file, you’re instructed to enter the commands from the Python prompt.

Just running open(example.txt) may not work because the Python interpreter only looks in the current folder to find the file. If you don’t start Python in the same folder, you need to tell the interpreter exactly where the file is is located. Here’s one way to do this:

$ python
>>> txt = open("/Users/Kevin/Dev/example.txt")
>>> print

If you’re not sure if you’re in the right directory, you can double check your directory. First start Python:

$ python

Then type these two commands:

>>> import os
>>> os.getcwd()

Remember to always import the os module before calling any os commands/functions.

Your result should look like this:

Mac terminal commands to get current directory

Coda 2 Tab Between Split Windows

I just spent about an hour searching the internet trying to figure out the keyboard shortcut to tab (or move) between the split windows within a tab in Coda 2. After looking through the Apple shortcuts, I finally found one that works:

Control + Tab

It’s so simple. But there’s a catch. To get this to work you first must open another tab before opening the Terminal window.


1. Create a new tab/document
2. Add a new split Document or Preview window
3. Add a new split Terminal window
4. Close the second Document or Preview

At this point you should be able to Control + Tab between the Document window and the Terminal window. It’s not ideal, but it works when needed.

On a related note, I’m interested to see what Panic has up their sleeve for Coda 2.5. It should be released soon.

Retiring my iPhone 3GS

I bought the iPhone 3GS on October 6, 2009. That’s 1378 days ago. I’ve put it through the ringer and I didn’t any major problems with it until a few months ago. Now unless it’s plugged in, it will randomly shut off even with a fully charged battery. I was hoping to keep it for a couple more months, but since it’s barely functional, I decided to upgrade. My iPhone 5 arrived in the mail today.

iPhone 3GS

Before I bought the 3GS back in 2009, I used a cheap flip phone. It did the basics, texting and phoning, but that’s it. Upgrading to an iPhone was a game changer. Instead of just carrying around a phone/messaging device, I now had portable computer in my pocket. A camera, maps, weather, internet browser, games, email, calendar, and more were always within reach. For better or for worse it changed my life. Of course, there were forerunners of the iPhone like the Sidekick or BlackBerries, but for me, my first taste of a multifunctional phone was the iPhone.