This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author oconnor663
Recipients berker.peksag, gvanrossum, oconnor663, vstinner, yselivanov
Date 2016-04-26.05:25:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461648315.57.0.326458433842.issue26848@psf.upfronthosting.co.za>
In-reply-to
Content
Related: The asyncio communicate() method differs from standard subprocess in how it treats input bytes when stdin is (probably mistakenly) not set to PIPE. Like this:

    proc = await create_subprocess_shell("sleep 5")
    await proc.communicate(b"foo")  # Oops, I forgot stdin=PIPE above!

The standard, non-async version of this example, communicate would ignore the input bytes entirely. But here in the asyncio version, communicate will try to write those bytes to stdin, which is None, and the result is an AttributeError.

Since the user probably only hits this case by mistake, I think raising an exception is preferable. But it would be nice to raise an exception that explicitly said "you've forgotten stdin=PIPE" instead of the unhelpful "'NoneType' object has no attribute 'write'". Maybe it would be worth cleaning this up while we're here?
History
Date User Action Args
2016-04-26 05:25:15oconnor663setrecipients: + oconnor663, gvanrossum, vstinner, berker.peksag, yselivanov
2016-04-26 05:25:15oconnor663setmessageid: <1461648315.57.0.326458433842.issue26848@psf.upfronthosting.co.za>
2016-04-26 05:25:15oconnor663linkissue26848 messages
2016-04-26 05:25:14oconnor663create