mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 09:00:23 +08:00
20 lines
343 B
Python
20 lines
343 B
Python
|
try:
|
||
|
import uio as io
|
||
|
except:
|
||
|
import io
|
||
|
|
||
|
try:
|
||
|
io.IOBase
|
||
|
except AttributeError:
|
||
|
print('SKIP')
|
||
|
raise SystemExit
|
||
|
|
||
|
|
||
|
class MyIO(io.IOBase):
|
||
|
def write(self, buf):
|
||
|
# CPython and uPy pass in different types for buf (str vs bytearray)
|
||
|
print('write', len(buf))
|
||
|
return len(buf)
|
||
|
|
||
|
print('test', file=MyIO())
|