Stop using aliased Exception
IOError is now OSError. The old name is merely a legacy compatibility alias.
This commit is contained in:
parent
22bf4fafff
commit
d6ba8e0b29
|
@ -333,13 +333,13 @@ def write(device_handle, data):
|
||||||
try:
|
try:
|
||||||
retrycount += 1
|
retrycount += 1
|
||||||
bytes_written = _os.write(device_handle, data)
|
bytes_written = _os.write(device_handle, data)
|
||||||
except IOError as e:
|
except OSError as e:
|
||||||
if e.errno == _errno.EPIPE:
|
if e.errno == _errno.EPIPE:
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
if bytes_written != len(data):
|
if bytes_written != len(data):
|
||||||
raise IOError(_errno.EIO, 'written %d bytes out of expected %d' % (bytes_written, len(data)))
|
raise OSError(_errno.EIO, 'written %d bytes out of expected %d' % (bytes_written, len(data)))
|
||||||
|
|
||||||
|
|
||||||
def read(device_handle, bytes_count, timeout_ms=-1):
|
def read(device_handle, bytes_count, timeout_ms=-1):
|
||||||
|
@ -364,7 +364,7 @@ def read(device_handle, bytes_count, timeout_ms=-1):
|
||||||
|
|
||||||
if xlist:
|
if xlist:
|
||||||
assert xlist == [device_handle]
|
assert xlist == [device_handle]
|
||||||
raise IOError(_errno.EIO, 'exception on file descriptor %d' % device_handle)
|
raise OSError(_errno.EIO, 'exception on file descriptor %d' % device_handle)
|
||||||
|
|
||||||
if rlist:
|
if rlist:
|
||||||
assert rlist == [device_handle]
|
assert rlist == [device_handle]
|
||||||
|
|
Loading…
Reference in New Issue