Weird newbie question

Matty Sarro msarro at
Thu Jan 26 17:05:57 EST 2012

Hey everyone. I'm running into a funky error as I work through "Learn
Python the Hard Way." What's weird is both idle and the python
interpreter in idle spit out an error about syntax, but when I run the
same script from the command line it works just fine, with no issue.
I'm not sure if its an issue with IDLE or if I'm doing something

Here's the book's code:

from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)

Here's my code:

from sys import argv
print "Here is your file %r:" % filename
print "I'll also ask you to type it again:"
file_again=raw_input("> ")

IDLE is saying that my error is on line 4, at the second set of
quotation marks. Since I can't get the error from the command line, I
can't actually see what the syntax error is that it's complaining
about. Any advice would really be appreciated, thank you!!

More information about the Python-list mailing list