EOFError on input function


#1

I’m running Atom on a Mac. When I run a simple program that calls for keyboard input, I get an “EOFError: EOF when reading a line”.

Here is my whole program:

sc = input (“Type”)
ab = str(sc)
print(ab)

When I run it, I can’t get past the first line of code without getting the EOF error.

BTW, the program works perfectly in IDLE.

Any thoughts?


#2

The package you’re using to run your code likely isn’t set up to handle input.


#3

The package I’m using is atom-runner. Is this package not able to handle input? If it isn’t, is there another package I could use?

Thanks for the input.


#4

You could install a terminal promt such as platformio-ide-terminal and run the program from the command line it provides inside Atom. This is more convenient than a normal terminal, as a single shortcut will open the shell to the current directory.

The package is standalone, and does not require any of the other platformio packages (or IDEs of any kind).


#5

Not to my knowledge. I recommend checking out the terminal packages, as @Aerijo suggested.


#6

Thanks for the advice. I installed the platformio-ide-terminal, but when I open it, the shell opens in my Desktop directory, and not the directory where the program is kept.

Is there some setting configuration, in this program, that I need to set for the terminal to open in the proper directory?

Thanks again.


#7

Open the platformio-ide-terminal settings (under Settings -> Packages), scroll down to the Working Directory setting, and set it to either Project or Active File.