Kent Johnson wrote: > >>Is there any way of checking all possible errors, show you all error >>messages, and then exit. > > I don't understand your question. Can you give an example of what you would > like to do? > The idea was check all exceptions before of exit. I made it :)
flag_error = False for x in [dir_lo, dir_k, dir_x]: try: os.listdir(x) except OSError, err_o: flag_error = True print "Error! %s: %r" % (err_o.strerror, err_o.filename) if flag_error: sys.exit() Now, I have a dudes: 1) Is it necessary use .exit() with some value (as 1) for indicate that has been an error? 2) With .listdir() the exception can checks if the directory exist, but how check if there are files in that directory too? Thanks in advance! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor