Hi,
I wrote the following code, but when I build it, it just prints the “What is your name?” and when I type in something after the printout and press enter it does not do anything.
Newbie input question
The output console in sublime only shows output, it does not accept input. If you want to run an interactive program you need to do it from a terminal or use something like SublimeREPL.
Sublime not executing function fully
I can not continue
ok, thank you.
I used PythonLauncher, but I’m still getting this error when I use input.
adjective = input("Please enter an adjective: ")
File “”, line 1, in
NameError: name ‘crazy’ is not defined
Here’s the code. Everytime I put in my input it gives me the undefined error.
Hi!
Make sure you’re running this script, because there’s no error in it. (crazy
is not event mentioned`)
Matt
As @math2001 mentioned, the script you showed above doesn’t mention the keyword crazy
at all. I’m going to assume that crazy
is what you typed into the prompt for Please enter an adjective
.
If that is the case it looks like it asked you for input, but when you gave it it tried to run the input as a script instead of giving it to the program you were running. That sounds like something a REPL would do (run what you give it as you give it) so you might want to double check that everything is set up right and that your input is going to where you expect it to.
The fact that the error message that it’s giving you says the file name is ""
may corroborate this. I would expect to be the name of the actual file you were running, and it seems reasonable that if you were just interactively typing things and having them run, there would be no filename (or it would be stdin). That said I don’t use this plugin so I have no idea if that means anything or not in this case.
Yep!
@OdatNurd message made me realize something: you’re running on python 2 right?
Well, the input
function evaluate what you typed in python 2. Instead, use raw_input
.
Matt
Hi,
Thank you. I think it was the version. I opened Idle that said I had version 3.5.2 and it worked fine.