>From the looks of it this doesn't have anything to do with asyncio. It
seems to be about the default buffering of sys.stdout, which asyncio
doesn't touch. Does this program exhibit the same behavior?
import time
while True:
print('hello')
time.sleep(5)
On Fri, Nov 27, 2015 at 5:44 AM, Alan Yorinks <[email protected]> wrote:
> I forgot to mention this is Python 3.5
>
>
> On Friday, November 27, 2015 at 8:43:24 AM UTC-5, Alan Yorinks wrote:
>>
>> I am the author of pymata-aio
>> <https://github.com/MrYsLab/pymata-aio/wiki>, an asyncio library for
>> communicating with Arduino boards. The example code below is a "fix" for a
>> problem encountered only on Windows, and I don't know if this is expected
>> behavior or a bug.
>>
>> The code uses pymata-aio to configure an Arduino for analog input on 2
>> pins and digital input input on 2 other pins. The Arduino reports analog
>> and digital input data updates asynchronously approximately every 17 ms. To
>> have the code work properly on Windows, the user must start python with the
>> -u option and in addition, add the flush=True option to the print
>> statement. If this is not done, the data that is being printed lags behind
>> the actual data changes.
>>
>> Neither the -u option nor the flush=True are required for Linux/Mac
>> operation. I suspect the differences between the OS's event loop
>> implementations is at the root of the problem.
>>
>> The code may be viewed here:
>> https://gist.github.com/MrYsLab/c3a69625cf844cbeb9e0.
>>
>> Any thoughts if this is a bug or not?
>>
>>
>>
>>
>>
>>
>>
--
--Guido van Rossum (python.org/~guido)