support reading data files from python. Reimpliment this rather than try to sort out passing file object through from python