Python script not working after update from 2.7 to 3.6


I am a new python programmer and atom user. I am working my way through the book Python Crash Course and one of the lessons on classes is below. The script worked when I used CodeSkulptor but I get the error message below in Atom (using Hydrogen). I also updated my Mac from Python 2.7 to 3.6.2. Any insight is appreciated!


I think that the first thing you need to do is check that the problem isn’t being caused by Hydrogen only detecting the last line. This seems probable, since the error should be happening on line 14, but it happens on line 15. You can do this by trying python "Ch" in Terminal or using a package such as script or atom-runner.

Python has a bit of a sticky situation with an old version, 2.7, being still in wide use. You will find information and tutorials specifically for Python 2 that won’t work in 3, and vice versa. Make sure to double-check your book to see what version it supports. Also, find a few good links discussing the differences and keep those handy for reference. Hydrogen is its own entity and includes its own Python interpreter. The interpreter, IPython, doesn’t support anything below Python 3.3. It’s pretty normal to have multiple versions existing at the same time. I have 2.7, 3.6, and IPython (though the framework I’m doing all my Python for is still on 2.7).


Thanks for the insights. I solved the issue. Appreciate you helping out a newbie!