Sublime Forum

Is this a bug? (python "input" not working in 'Build' or '>>> console')

#1

Maybe this is already known. this code doesn’t seem to run properly in the ‘build’ window

a = input('enter text: ')
print(a)

I also tried it using the python boilerplate stuff. neither seems to work. and if I try executing the below
code using the >>> console…

a = input('enter text ')
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: input(): lost sys.stdin

maybe the “build” window where the program seems to execute does not behave like a terminal or?

at any rate, the >>> python console in Sublime Text ought to work like any other Python >>> console right?

0 Likes

#2

something in the html has chewed up my preformatted text

>>> a = input('enter text ')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: input(): lost sys.stdin
0 Likes

Output issue in sublime text
#3

When you execute code in Sublime (either via a build system or interactively in the console), there is no way to capture input. More technically, the console is connected to stdout and stderr but not stdin. So it’s not possible to run an interactive program from within Sublime directly.

That said, apparently SublimeREPL provides this sort of functionality, although I don’t use it myself so I don’t know much about it.

0 Likes

Error executing codes with input
#4

ok thanks hehe :slight_smile: i guess a shallow search would have found that out. i just didn’t see it coming since there’s a console that runs in sublime.

0 Likes