On most OSes, select() and other polling APIs always report disk files to
be "ready", so you basically can't use asyncio with them. On Windows it
will fail; on *n*x it will appear to work but actually you are doing the
whole thing synchronously. The only way to overlap disk I/O with asyncio
events would be to do the disk I/O on a separate thread.

Someone is working on sendfile support (
https://code.google.com/p/tulip/issues/detail?id=144,
http://bugs.python.org/issue17552) which would help overlap disk I/O and
socket I/O for the specific case of serving a file from disk directly to a
socket, but even that would be pretty limited.


On Mon, Aug 25, 2014 at 3:06 PM, Ludovic Gasc <[email protected]> wrote:

> Hi,
>
> I'm looking for the best way to read/write files with AsyncIO.
> Ideally, I want to r/w asynchronously, like with network.
>
> I've found this: https://gist.github.com/kunev/f83146d407c81a2d64a6
>
> Is it ok, or do you have a better suggestion ?
>
> Regards.
>



-- 
--Guido van Rossum (python.org/~guido)

Reply via email to