I want to read Fortran 90 binary files in Python and hence there is this module which has been developed for that in Scipy called as "fortranFile", as given here fortranFile module
How do I include this module in python so that I can call it from my code like
import fortranFile
f = fortranFile('file.bin')
x = f.readReals('f')
print x
right now, I get the error
Traceback (most recent call last):
File "readfortbin.py", line 5, in <module>
from fortranFile import fortranFile
ImportError: cannot import name fortranFile
I made a folder "fortranFile" in my /usr/lib/python2.7/dist-packages directory and added the "fortranFile.py" file to that folder. I know that I am missing something... Please suggest how I should proceed.
from fortranFile import FortranFile. I've added an answer below showing how to install the package from the PyPi package repository which has the added convenience of automatic updates when new versions are released.