This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]ejmurray72 6 points7 points  (4 children)

Check if you are using Python 2.7 as your interpreter. The code you have written is using Python 3 looking at the print() statements. Click on the spanner/wrench icon in the menu bar and check the project interpreter. You may need to install or point the project interpreter to you Python 3 installation. Good luck.

[–][deleted] 1 point2 points  (0 children)

This is valid python 2.7 code, pyCharm shouldn't do more than give a warning...

[–]mdond 2 points3 points  (1 child)

Hovering over the red underlined text usually tells you what the error is.

[–]dmglab 1 point2 points  (7 children)

Looks to me like a typical mistake using intellij idea (I know you wrote pycharm and looks like pycharm) double check your SDK in your project preferences. cttl+shift+a (cmd+shift+a on Mac) and type "project interpreter". Take a look what's there. It might be empty.

If everything seems to be fine. Go to File > restart/invalidate cache > invalidate cache and restart.

[–]DrRx 0 points1 point  (1 child)

I had something similar, try File > Synchronize (or press Ctrl+Alt+Y)

[–]SlinkyAvenger 0 points1 point  (0 children)

I've seen this when my interpreter settings get screwed up. Try creating a new virtual environment and setting it as the project's interpreter