New submission from Gurmeet Singh:

1. The read mode is not the default mode as mentioned in the docs.python.org. 
In particular see the first Traceback below - "b" does not work (as it does in 
C though) and 
you are forced to use "rb" instead.

2. io.BufferedReader does not implement read1 (the last lines of trace below)

3. io.FileIO does not implements single OS system call on read() - instead 
reads a file until EOF i.e. ignores the arguments supplied to read() - larger 
arguments are slower to execute (see the read calls in the trace below). 

_________________

>>> import io
>>> fl = io.FileIO('c:/temp9/Capability/Analyzing Data.mp4', 'r')
>>> byt = fl.read()
>>> len(byt)
70934549
>>> fl.close()
>>> fl = io.FileIO('c:/temp9/Capability/Analyzing Data.mp4', 'r')
>>> byt = fl.read(256)
>>> len(byt)
256
>>> byt = fl.read(512)
>>> len(byt)
512
>>> byt = fl.read(1024)
>>> len(byt)
1024
>>> byt = fl.read(4096)
>>> len(byt)
4096
>>> byt = fl.read(10240)
>>> len(byt)
10240
>>> len(fl.read(40960))
40960
>>> len(fl.read(102400))
102400
>>> len(fl.read(1048576))
1048576
>>> fl.close()
>>> fl = io.FileIO('c:/temp9/Capability/Analyzing Data.mp4', 'r')
>>> len(fl.read(70934549))
70934549
>>> len(fl.read(70934549))
0
>>> fl.close()
>>> fl = io.FileIO('c:/temp9/Capability/Analyzing Data.mp4', 'r')
>>> b = bytearray(70934549)
>>> fl.readinto(b)
70934549
>>> fl.close()
>>> fl = open ('c:/temp9/Capability/Analyzing Data.mp4', 'b', buffering = 0)
Traceback (most recent call last):
  File "<pyshell#31>", line 1, in <module>
    fl = open ('c:/temp9/Capability/Analyzing Data.mp4', 'b', buffering = 0)
ValueError: Must have exactly one of create/read/write/append mode and at most 
one plus
>>> fl = open ('c:/temp9/Capability/Analyzing Data.mp4', 'rb', buffering = 0)
>>> type(fl)
<class '_io.FileIO'>
>>> cfl = io.FileIO('c:/temp9/Capability/Analyzing Data.mp4', 'r')
>>> type(cfl)
<class '_io.FileIO'>
>>> cfl.close()
>>> cfl = open ('c:/temp9/Capability/Analyzing Data.mp4', 'rb', buffering = -1)
>>> type(cfl)
<class '_io.BufferedReader'>
>>> io.DEFAULT_BUFFER_SIZE
8192
>>> len(fl.read(70934549))
70934549
>>> cfl.close()
>>> cfl = open ('c:/temp9/Capability/Analyzing Data.mp4', 'rb', buffering = -1)
>>> len(fl.read1(70934549))
Traceback (most recent call last):
  File "<pyshell#44>", line 1, in <module>
    len(fl.read1(70934549))
AttributeError: '_io.FileIO' object has no attribute 'read1'
>>>

----------
messages: 184330
nosy: gsingh
priority: normal
severity: normal
status: open
title: Some IO related problems on x86 windows

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17440>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to