IOError: [Errno 22] Invalid argument when writing large bytestring
===

I'm getting

    IOError: [Errno 22] Invalid argument

when I try to write a large bytestring to disk with `f.write()`, where `f` was opened with mode `wb`.

I've seen lots of people online getting this error when using a Windows network drive, but I'm on OSX (10.7, with a standard HFS+ local filesystem). I'm using Python 3.2.2.

I also tried mode `w+b` based on [this Windows bug workaround](http://support.microsoft.com/default.aspx?scid=kb;en-us;899149), but of course that didn't help.

The data is coming from a large numpy array (almost 4GB of floats). It works fine if I manually loop over the string and write it out in chunks. But because I can't write it all in one pass, `np.save` and `np.savez` fail and so I have to do that manually, which is a pain. I get a similar error when I try to save it into an existing HDF5 file with `h5py`.

Any thoughts?