Reading file error

satish skchim0 at engr.uky.edu
Thu Feb 19 05:11:12 EST 2004


Hi all,

 I am writing a file by name "input" out,  with a small python code below:
 
        grid=open('input','w')
        grid.write(' ')
        grid.write('/*number_of_zone\n')
        grid.write(' ')
        grid.write('2\n')
        grid.write(' ')
        grid.write('/*zone_number 1\n')
        grid.write(' ')
        grid.write('quadratic 50 25 6 2\n')
       
Upon execution, I get the file "input" whose contents are as per below:

 /*number_of_zone
 2
 /*zone_number 1
 quadratic 50 25 6 2
 

Now, when I tried to read this through my fortran code I get the following 
errors:

/*zone_number 1

 Input/Output Error 153: Input file ended

   In Procedure: in_and_out..read_input
        At Line: 4472

      Statement: List-Directed READ
           Unit: 10
   Connected To: Work File
           Form: Formatted (contains List-Directed records)
         Access: Sequential
Records Read   : 2
Records Written: 2

End of diagnostics
 

	Outline of fortran code:

SUBROUTINE read_input()
OPEN (15, FILE='input')       
READ .....
......
CLOSE(15)
END SUBROUTINE read_input

Some part of the error is related to some "scratch file" with unit=10 that the 
fortran code is generating, which, I don't want to pay attention to.

My main problem is that when I generate "input" without python and simply 
write everything by opening the file manually in my editor and then execute 
it with the same fortran code, I don't get any such strange errors and it 
works perfectly fine. I am therefore, wondering if this has got to do 
anything with python. 


Can someone help ??


Thanks in advance


Best Regards,
Satish Kumar Chimakurthi


-- 
SATISH KUMAR CHIMAKURTHI
Graduate Research Assistant
CFD GROUP
UNIVERSITY OF KENTUCKY
LEXINGTON
KENTUCKY - 40508
Email: skchim0 at engr.uky.edu
Mobile: 859-420-9890




More information about the Python-list mailing list