Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7851 > unrolled thread
| Started by | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| First post | 2011-06-17 13:08 -0700 |
| Last post | 2011-06-17 13:08 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: bug in large file writes, 2.x and 3.x Ethan Furman <ethan@stoneleaf.us> - 2011-06-17 13:08 -0700
| From | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| Date | 2011-06-17 13:08 -0700 |
| Subject | Re: bug in large file writes, 2.x and 3.x |
| Message-ID | <mailman.90.1308340505.1164.python-list@python.org> |
MRAB wrote:
> On 17/06/2011 20:15, Ethan Furman wrote:
>> Ethan Furman wrote:
>>> Windows platform (XP Pro, SP2).
>>>
>>> This works fine on local drives, but on network (both 2003 Server, and
>>> Samba running on FreeBSD) the following produces an error:
>>>
>>> --> data = '?' * 119757831 # use b'?' if on 3.x
>>> --> test = open(r's:\junk.tst', 'wb')
>>> --> test.write(data)
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> IOError: [Errno 22] Invalid argument
>>
>>
>> Update: 10Mb worth of data succeeds, 50+Mb fails.
>
> What about around 2**24 bytes?
8<----------------------------------------------------------------------
def test_network_write_failure():
size = 100 * 1024 * 1024
half = size // 2
while 'Here we go!':
print('trying', size)
data = b'?' * size
test = open(r's:\test.jnk', 'wb')
try:
test.write(data)
except IOError:
test.close()
else:
size = size + half
half = half // 2
continue
test = open(r's:\test.jnk', 'wb')
try:
test.write(data[:-1])
except IOError:
test.close()
size = size - half
half = half // 2
continue
print("%d succeeded, %d failed" % (size-1, size))
break
if __name__ == '__main__':
test_network_write_failure()
8<----------------------------------------------------------------------
On my machine I get:
c:\temp>\python32\python nwf.py
trying 104857600
trying 52428800
trying 26214400
trying 39321600
trying 45875200
trying 49152000
trying 50790400
trying 51609600
trying 51200000
trying 50995200
trying 50892800
trying 50841600
trying 50867200
trying 50880000
trying 50873600
trying 50870400
trying 50868800
trying 50868000
trying 50868400
trying 50868200
trying 50868100
trying 50868150
trying 50868175
trying 50868187
trying 50868181
trying 50868178
trying 50868177
50868176 succeeded, 50868177 failed
~Ethan~
Back to top | Article view | comp.lang.python
csiph-web