I installed SublimeREPL to interact with my python code via Anaconda Package Control.
NameError: name 'tony' is not defined
I noticed that I am getting a NameError on a simple input function.
The error is caused by the python version difference between SublimeREPL(python v2) and my Sublime Python Built Systems version(v3).
I followed this post to upgrade SublimeREPL to version 3, however, you can not edit Main.Sublime-Menu. Please advise on best steps to take in order to update SublimeREPL to Python v3.
def greetings():
name_input = input('please enter your name:' )
print('hello {}, please enter your age: '.format(name_input))
greetings()
On macOS, the file you want to edit is located at ~/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/Python/Main.sublime-menu
. Open it up in Sublime as a JSON file. Go to line 53 and change python
to python3
, optionally with a path preceding it if you know exactly where it's stored. For example, if you're using Homebrew, it might be in /usr/local/bin/python3
. The line should now look something like this:
"cmd": ["python3", "-u", "$file_basename"],
or this
"cmd": ["/opt/local/bin/python3", "-u", "$file_basename"],
(this is the MacPorts location).
Save the file, and the menu option should now work.