1try: 2 import uio as io 3except ImportError: 4 import io 5 6a = io.BytesIO(b"foobar") 7try: 8 a.seek(-10) 9except Exception as e: 10 # CPython throws ValueError, but MicroPython has consistent stream 11 # interface, so BytesIO raises the same error as a real file, which 12 # is OSError(EINVAL). 13 print(type(e), e.args[0] > 0) 14