I tried to use Popen of python2/3 to interact with micropyton unix port, but will be blocked by proc.stdout.readline() function:
Code: Select all
proc = subprocess.Popen(['./micropython', '-i'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc.stdin.write(b'2+2\n')
proc.stdin.flush()
proc.stdout.readline()
Thanks.