problem with usbtmc-communication

Dave Angel d at davea.name
Thu Dec 6 15:10:17 EST 2012


On 12/06/2012 02:41 PM, Jean Dubois wrote:
> On 6 dec, 15:50, w... at mac.com wrote:
>> <snip>
>> Sorry about the misunderstanding (and subsequent waste of bandwidth).  However, if you will look at the serial reads and writes in that handler, you will see that it does things like "serial.read(n)" where "n" is an explicit number, the number of bytes to be read from the serial buffer.
>>
>> -Bill
> I tried changing measurementcurr=usbkeith.readline() to
> measurementcurr=usbkeith.read(10000)
> but this leads to trouble with the usbtmc-thing:
>
> Measured current 1:
> Traceback (most recent call last):
>   File "./keith2200rev2.py", line 26, in <module>
>     measurementvolt=usbkeith.read(10000)
> IOError: [Errno 110] Connection timed out
>
> and hereafter I need to restart the Keithley...:-(
I can't see why you used a count of 10000.  Isn't the whole problem
supposed to be because it doesn't produce a whole line at a time?  So
after requesting a measurement, if you know the size, use that in the
read() method.  And if you don't know the size, read it one byte at a
time till it make sense.

-- 

DaveA




More information about the Python-list mailing list