KeyError: 'AIN0' | LabJack
 

KeyError: 'AIN0'

2 posts / 0 new
Last post
mathenym
mathenym's picture
KeyError: 'AIN0'

Hello, i am having a hard time getting d.streamStart() and d.streamData() to work in python 3. I have been able to get the code to work with i create a GUI with pyQT without buttons. When i add buttons to start streaming and plot the data, i get:

KeyError: 'AIN0' 

The code below works for when i use d.getTemperature. But cant seem to use the stream fucntion. Help? 

File Attachment: 
LabJack Support
labjack support's picture
In your code, AIN0 is not

In your code, AIN0 is not being streamed. Your configuration is:

d.streamConfig(NumChannels=1,PChannels=[1],NChannels=[31],Resolution=1,ScanFrequency=10000,SamplesPerPacket=25)

Positive channel (PChannel) 1 is AIN1. Change your code to read from AIN1 to help prevent that "KeyError: 'AIN0'":

line = r["AIN1"]