2022-08-18 08:57:45 +02:00
|
|
|
import io
|
2017-08-20 20:57:36 +02:00
|
|
|
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).
|
2018-05-01 03:59:23 +02:00
|
|
|
print(type(e), e.args[0] > 0)
|