'SublimeREPL Python - Run Current File not working due to Python system build

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()

Sublime Text 3 Image



Solution 1:[1]

great question and answer. note; you can use f-strings , improved string formatting syntax on your code, see below.

def get_user_input():
    name_input = input('please enter your name:' )
    print(f'hello {name_input}, please enter your age: ')
get_user_input()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ASE Dev