[SciPy-user] reading character arrays from fortran file

Andreas Matthias andreas.matthias@gmail....
Tue Sep 23 15:46:16 CDT 2008

I'm trying to read a character array from a binary fortran file
and the following code seems to work:

from scipy.io import fopen
fd1 = fopen.fopen('fort', permission='rb', format='n')
print fd1.fort_read(0, dtype='str')

But then I get this deprecation warning saying that I should
use npfile instead of fopen. Unfortunately, I don't get npfile
to do the same as the code above. I tried the following which
does not work:

from scipy.io import npfile
fd2 = npfile('fort')
print fd2.read_array(dt='str', shape=-1)

What's the correct way to do it with npfile?


More information about the SciPy-user mailing list