Hi, I am using File I/O to input an xml file form user and parse it.I have used something like this:
file_input = raw_input("Enter The ODX File Path:") odx_file_output = raw_input("Enter the output file path : ") log_file_output = raw_input("Enter the path for LogFile : ") saveout = sys.stdout try: f_open=open(odx_file_output, 'w') except: print "cant open file" sys.exit() sys.stdout = f_open try: input_xml = open(file_input,'r') except: print "The File Cannot Be Opened" sys.exit() if input_xml.read(5)!='<?xml': print "Invalid File" input_xml.close() sys.exit() else: xmldoc = minidom.parse(input_xml) input_xml.close() if xmldoc.childNodes[1].getAttribute("DtdVers") == u'1.1.4' or xmldoc.childNodes[1].getAttribute("DtdVers")== u'1.1.5': pass else: print "Invalid Version" sys.exit() After this some more code follows,but i have pasted only the i/o part .when i run it in interactive mode(using F5),first time it does fine,but second time it throws error like: Traceback (most recent call last): File "C:\Projects\ODX Import\code_ini\odxparse.py", line 250, in <module> file_input = raw_input("Enter The ODX File Path:") ValueError: I/O operation on closed file any idea what should be modified. Thx -- http://mail.python.org/mailman/listinfo/python-list