Learn Python 3 the Hard Way Exercise 26. Can’t Find Error

I’m working my way through the book Learn Python 3 the Hard Way and I made my way to exercise 23, String, Bytes, and Character Encodings. I downloaded the language.txt file and typed out the program, but when I go to run it in my MacOS shell I get nothing! No error code, syntax error, etc… just nothing as if I never typed it in to begin with. I looked over the code in Atom but didn’t see any errors and tried to look around online to see if anybody else had this problem, but since I don’t really know what i’m looking for it’s proving a little irritating. Thanks in advance for any help.

If you can post the code to https://gist.github.com/ I’ll take a look.

I actually have the same problem, my gist is

https://gist.githubusercontent.com/Alexevh/595d60e95489f37e5e62136e7a0e63af/raw/da1bb2cdab54cdd8c4835dedb47e07653c793640/test

In your case, your indentation is off. “Indentation” means where the first character of a line starts. If you look at mine, the last 3 lines of mine are like this:

    print(raw_bytes, "<===>", cooked_string)


languages = open("languages.txt", encoding="utf-8")

main(languages, input_encoding, error)

But, yours are like this:

    print(raw_bytes, "<===>", cooked_string)
    languages = open("languages.txt", encoding="utf8")
    main(languages, encoding, error)

See how mine, the line starting with print is indented just like yours, however, my next two lines start at column 0, but yours start at the same column as print.

Yes I just discovered indentation is important part of python in the def exercise 18. I did not indent and i got an indentation error. Also I noticed he did not type “utf-8” but “utf8”, which is not a big deal. Sorry reading this book is making me anal about typing things perfectly :slight_smile: