Linked Questions
25 questions linked to/from Python unexpected EOF while parsing
275 votes
15 answers
949k views
Why do I get "NameError: name '...' is not defined" (or a SyntaxError, or a number instead of a string) when using the input function (in Python 2.x)?
I am getting an error when I try to run this simple script: input_variable = input("Enter your name: ") print("your name is" + input_variable) Let's say I type in "dude",...
1 vote
3 answers
4k views
SyntaxError: unexpected EOF while parsing input commands [duplicate]
Today I was writing this program from random import randint def practice(): command = input("Welcome to math practice! Type mult tables to practice multiplication tables, or simp add for single ...
0 votes
1 answer
420 views
SyntaxError: unexpected EOF while parsing python error message [duplicate]
My code is simple. The problem is input command. I try to write python code that accept user string input from the keyboard and display it. But it Generate this error message always SyntaxError: ...
0 votes
1 answer
114 views
Splitting two integers into separate variables [duplicate]
Is it possible to split an input of two integers separated by a space such as '1 2' to be split into two separate variables? I have tried ratio = input() a,b = ratio.split(' ') but it returns an ...
0 votes
1 answer
63 views
Syntax error. Can't get past input statement [duplicate]
I'm trying to create a program, where the user types a word 5 times and then I plot the results. But I can't get past the first input statement. import matplotlib.pyplot as plt import time as t ...
1 vote
0 answers
75 views
Unexpected EOF while parsing - Python [duplicate]
I'm not sure what the issue is with my code but I get the error "Unexpected EOF while parsing" when attempting to go through my try and except code. Here is the code that's causing problems: ` def ...
0 votes
1 answer
76 views
How to make this username and password login page work [duplicate]
I have made this code in an attempt to create a simple 'Create a user' program which take the inputs and puts them into a csv file however I am finding that I keep getting the error unexpected EOF ...
12 votes
4 answers
36k views
Command-line input causes SyntaxError [duplicate]
I have this code: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929&...
2 votes
4 answers
45k views
NameError: name '[string]' is not defined [duplicate]
When testing my program, I keep getting this error: 1. Encrypt a file 2. Decrypt a file ----> 1 Enter the filename you'd like to encrypt: test Traceback (most recent call last): File "./encrypt....
4 votes
1 answer
2k views
How to fix SyntaxError: invalid syntax on a Raspberry Pi?
I have code wrote on Windows, compiles and works correctly, but fails on the raspberry pi wrote some simple test code to see if it spits out the same error a = input('this is a test string to split ...
0 votes
1 answer
2k views
File in and file out in python
i had created a python program but it was not working. this program would take in the input for a file and then display the file contents . the only error i was getting is a syntax error well i could ...
0 votes
1 answer
1k views
input has an EOF error only when I run in command line
I'm writing a console application in python 3, and when I run my code in the Pycharm IDE, it runs just fine. If I run the code by opening it in python3, I get the exception "unexpected EOF while ...
0 votes
2 answers
826 views
Error whilst running Python .py files from terminal on Mac
I have a slight problem trying to run a python program from the terminal on my Mac. When my '.py' program has a 'input ("press the enter key to find out.")' command the terminal gives the following ...
-2 votes
1 answer
837 views
Python unexpected EOF in for loop [repl.it]
Note: This question is about a problem with repl.it, not a general problem. Note: You might consider this as a duplicate, but in fact it isn't. These do not suit my problem: ...
0 votes
2 answers
976 views
Python Not Outputting Correct Values [duplicate]
Here's the syntax of the problem I'm facing: Heating and cooling degree-days are measured by utility companies to estimate energy requirements. If the average temperature for a day is below 60, then ...