Re: "Try:" which only encompasses head of compound statement

2007-08-28 Thread Jameson . Quinn
Those are some good responses, but I think they focused a little too much on the specifics of my example - especially the 'print' statement. In real life, I want to set some return values to sensible defaults if the file doesn't exist, but I want the errors from inside the block to trickle up as no

"Try:" which only encompasses head of compound statement

2007-08-27 Thread Jameson . Quinn
I have: try: for line in open(myFileName): count += 1 except IOError: print "Can't open myfile" (I know, this is bad, I never close the file, but its just for illustration). But then I change it to: try: for line in open(myFileName): count += openAndProcessSubfile(lin