Skip to content

Conversation

vslotman
Copy link

Sometimes timeouts are not handled nicely, resulting in the following stacktrace:

print self.dev.ask('*IDN?')
File "/usr/local/lib/python2.7/dist-packages/usbtmc/usbtmc.py", line 635, in ask
return self.read(num, encoding)
File "/usr/local/lib/python2.7/dist-packages/usbtmc/usbtmc.py", line 618, in read
return self.read_raw(num).decode(encoding).rstrip('\r\n')
File "/usr/local/lib/python2.7/dist-packages/usbtmc/usbtmc.py", line 547, in read_raw
msgid, btag, btaginverse, transfer_size, transfer_attributes, data = self.unpack_dev_dep_resp_header(resp)
File "/usr/local/lib/python2.7/dist-packages/usbtmc/usbtmc.py", line 468, in unpack_dev_dep_resp_header
msgid, btag, btaginverse = self.unpack_bulk_in_header(data)
File "/usr/local/lib/python2.7/dist-packages/usbtmc/usbtmc.py", line 464, in unpack_bulk_in_header
msgid, btag, btaginverse = struct.unpack_from('BBBx', data)
error: unpack_from requires a buffer of at least 4 bytes

@alexforencich
Copy link
Contributor

I have seen this issue before; but have not been able to get to the bottom of it as it only appears sporadically when communicating with some particular pieces of hardware. Are you sure this is the correct approach here? And are you sure that this isn't a result of a firmware implementation bug in the device in question? And speaking of which, what devices are you running in to this issue with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants