Fix Typo

Fix Typo

If you look at STDOUT it is always displaying special key, which is odd. For the alphanumeric characters it’s supposed to print out alphanumeric. We have our first bug.

Let’s take a look at the section of our code responsible for printing the on_press function:

def on_press(key):
    try:
        print('alphanumeric key {0} pressed'.format(key.car))
    except AttributeError:
        print('special key {0} pressed'.format(key))

I highly doubt the key object has a .car attribute. However, it probably has a .char attribute.

Let’s fix that error and re-run the project.

Run after fixing typo

Nice.

Source Code Snapshot

GitHub repo at this point in time