mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 17:10:24 +08:00
14 lines
319 B
Python
14 lines
319 B
Python
|
try:
|
||
|
import uio as io
|
||
|
except ImportError:
|
||
|
import io
|
||
|
|
||
|
a = io.BytesIO(b"foobar")
|
||
|
try:
|
||
|
a.seek(-10)
|
||
|
except Exception as e:
|
||
|
# CPython throws ValueError, but MicroPython has consistent stream
|
||
|
# interface, so BytesIO raises the same error as a real file, which
|
||
|
# is OSError(EINVAL).
|
||
|
print(repr(e))
|