EOF WHEN READING A LINE PYTHON

Hi everyone!I am finding out to routine experiments for sibbap.org3 on a MacBook.However, after several days trying to fix an error, I have actually decided to short article my difficulty in this forum, hoping to finally have the ability to solve it and that probably it have the right to assist future programmers.

You watching: Eof when reading a line python

I am programming a really simple job, and also the problem appears when the regimen asks for the participant’s name.

My script is as follows (constants.py file):NAME = input ("Insert participant name: ")

and also the error is as follows:EOFError: EOF once analysis a line

I’ve already check out that if you usage Python 3, you must use input () rather of raw_input ().Also it can be the variation of sibbap.org 3 provided (I have actually the many recent one)… and many type of other suggestions, obviously not successful for my situation.

I am so grateful for any kind of help!

Best,Cris


Text responses in python: Input() function and dialogue boxes
jonathan.kominskies April 27, 2020, 2:45pm #2

Is tbelow actually a space in between “input” and the open-parentheses? If so tbelow shouldn’t be.

See more: Last Man Standing Book Review, Last Man Standing By David Baldacci

Also, you’ve made certain the error is coming from that line in particular?


Cris April 27, 2020, 3:22pm #3

Sure enough, tright here are no spaces (I don’t recognize why it appears like this right here, I copied and pasted directly).And the error is that, as it shows up to me.Insert participant name: Traceearlier (many recent contact last):Data “mypath”, line 36, in NAME = input(“Insert participant name:”)EOFError: EOF as soon as reading a line

No other ideas appear, I have actually ongoing investigating but have actually not uncovered any kind of other advantageous information.Thank you so much for assist me!


jonathan.kominskies April 27, 2020, 4:19pm #4

See here: https://stackoverflow.com/questions/42891603/how-to-remove-eoferror-eof-when-reading-a-line

This is reportedly simply what happens with “input” as soon as it is placed right into a manuscript. It works fine as soon as you carry out it in a python console. One solution is to embed it in a try/other than framework, as in that link.

Because you are using sibbap.org, one more solution in general would be to use the GUI library and make this a dialog.

from sibbap.org import guiPinformation = gui.Dlg(title="Participant info")Pinfo.addField("Insert participant name: ")Pinformation.show()if Pdetails.OK: Pdat = Pdetails.information NAME = Pdat<0>A few more lines of code, but more functional in the long run and broken right into more easily identifiable components if somepoint needs to be solved.


1 Like
Cris April 27, 2020, 4:19pm #5

It certainly works!

*
I understand also the approach, and also it is true, in the consingle it functioned initially.I finally see my task!

Many type of thanks!

Best,Cris


Home Categories FAQ/Guidelines Terms of Service Privacy Policy

Powered by sibbap.org, ideal regarded with JavaScript enabled