For whatever reason, it does not like Version 2 when I run the code. I changed it to run on Version 3 and it worked.
Using VSC and the code runner you are utilizing. Try running the following Commands to determine what version it is using to execute to script:
import sys
print(sys.version_info)
If you are using Code Runner on VSC, you want to add the following to the settings.json file:
"code-runner.executorMap": {
"python": "<fully qualified path to version 3>"
}
This will change the default python version for Code Runner to Version 3.
I usually use Atom and didn't have any problems. I installed VSC and tried it with Code Runner and immediately had issues. I had already pointed Atom to use python3, when I used other methods to run it on 2 I got the same error message.