file write IOError Invalid argument

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jul 20 07:54:57 CEST 2009


En Thu, 16 Jul 2009 17:41:39 -0300, Robert Robert  
<robertrobert93 at yahoo.com> escribió:

> I am trying to write a binary string to file on a windows network share.  
> I get an IOError. I've read that it is because the file size is too  
> large. I did a type( binaryString) and saw that it was type "str". So I  
> loop through it one by one element and use f.write to write to file, and  
> it worked without any error. However it took a long while to write to  
> file. I was wondering how I could split this binary string into N number  
> of chunks efficiently and write them to file.

some_string[i:i+BLOCK_SIZE]
returns a slice of the original string, starting at position i, with  
length BLOCK_SIZE.

-- 
Gabriel Genellina




More information about the Python-list mailing list