EOF Error on Python 3 lesson (Sals shipping)


I did my own code since I wanted to try it my way first and then see the answer in the video, but i’m getting the following error when running my code: Error: EOF when reading a line

Edit: No idea how to paste code here (i’m dumb) so here’s a picture:

I wasn’t even totally finished, just trying to see if what I had so far was working. Can someone help me out here and explain or just correct my code so that it works?

Edit2: Also, I’m 100% sure my code isnt the most efficient or w/e but im still learning. Still, i would love to make it work as close as possible to the way I currently have it.

Check out this previous answer (basically using input in that lesson will probably throw an error no matter what)-

As for code formatting check out this FAQ-

Thanks for your answer! However, I noticed that when importing the code to PyCharm, I got:

Process finished with exit code 0

without any of my code even starting! No input, nothing

Edit: Here is a picture of my code on PyCharm

1 Like

I’m not sure why that’d be the case but perhaps some pycharm settings are configured in a way that winds up with the input statement failing (perhaps a print of the name where the variable is stored could help and after too to see if it’s skipped or what). A quick web serach seems to suggest a few folks have come across a similar issue so hopefully there’s a solution out there somewhere.

1 Like

Again, thanks so much for your responses. I edited my previous comment with a copy of a picture of the error I got.

Ah no, that’s something else entirely. Or at least not just Pycharm having a problem with input(). Exit code 0 suggests a successful run of the code. The wee warning from Pycharm from the cursor position is straightforward. When running that code that partciular line cannot be reached. All in all the code seems to be running just fine. What did you expect to get out (did you ask for it)?

I expected it to run the input part:

def cheapest_ground_shipping(pckg_weight):

pckg_weight = (input("How much does your package weigh?(lbs): "))`

So upon calling def cheapest_ground_shipping(3) it would call for the input

pckg_weight = (input("How much does your package weigh?(lbs): "))
pckg_weight = int(pckg_weight)

def cheapest_ground_shipping(pckg_weight):

Expecting it is one thing but have you actually tried it? Nothing will happen unless you ask it to. Just to note that def cheapest_ground_shipping(3) is not how you’d call a function, it’d throw an error either way. Perhaps have a quick look back at the syntax of creating and calling functions.

@regan254 what difference are you expecting between those statements and the original version?