<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18854"></HEAD>
<BODY>
<DIV><SPAN class=343044219-14012010><FONT size=2 face=Arial>Why am I getting an
invalid systax on the first except in the following code. It was copid from the
python tutorial for beginners. Thanks, Ray</FONT></SPAN></DIV>
<DIV><SPAN class=343044219-14012010><FONT size=2 face=Arial>import
sys<BR>try:<BR> #open file stream<BR> file =
open(file_name, "w"<BR>except IOError:<BR> print "There was an
error writing to", file_name<BR> sys.exit()<BR>print "Enter
'", file_finish,<BR>print "' When finished"<BR>while file_text !=
file_finish:<BR> file_text = raw_input("Enter text:
")<BR> if file_text ==
file_finish:<BR> # close the
file<BR>
file.close<BR>
break<BR> file.write(file_text)<BR>
file.write("\n")<BR>file.close()<BR>file_name = raw_input("Enter filename:
")<BR>if len(file_name) == 0:<BR> print "Next time please
enter something"<BR> sys.exit()<BR>try:<BR>
file = open(file_name, "r")<BR>except IOError:<BR> print
"There was an eror reading file"<BR> sys.exit<BR>file_text =
file.read()<BR>file.close<BR>print
file_text<BR></FONT></SPAN></DIV></BODY></HTML>