blob: c07ad900c9b183d4075ddb34e72db39c17a4d9dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
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))
|