Unusual i/o problems

Diez B. Roggisch deets at nospam.web.de
Wed May 16 10:49:27 EDT 2007


saif.shakeel at gmail.com wrote:

> Hi,
>     I am parsing an xml file ,before that i have replaced a string in
> the original xml file with another and made a new xml file which will
> now be parsed.I am also opening some more files for output.The
> following code shows some i/o commands.
> file_input = raw_input("Enter The ODX File Path:")
> input_xml = open(file_input,'r')
> 
> (shortname,ext)=os.path.splitext(file_input)
> f_open_out=shortname+".ini"
> log=shortname+".xls"
> test_file=shortname+"testxml.xml"
> 
> saveout = sys.stdout
> 
> xmlcont=input_xml.read()
> input_xml.close()
> 
> xmlcont=xmlcont.replace('localId','dataPackageId')
> 
> output_file = open(test_file,"w")
> output_file.write(xmlcont)
> output_file.close()
> 
> f_open=open(f_open_out, 'w')
> logfile=open(log,"w")
> sys.stdout = f_open
> 
>              After this i have to parse the new xml file which is in
> output_file .hence
> 
> input_xml_sec = open(output_file,'r')
> xmldoc = minidom.parse(input_xml_sec)
> 
>                   But i am getting an error on this line
> (input_xml_sec = open(output_file,'r')).I have tried to figure out but
> not able to debug.Can someone throw some light or anything they feel
> could be going wrong somewhere.

How about telling us what the error is?

Suggested read:

http://www.catb.org/~esr/faqs/smart-questions.html

Diez
Diez



More information about the Python-list mailing list