u3allio.py example | LabJack

u3allio.py example

2 posts / 0 new
Last post
Ranger Rick
Jon Lepp's picture
u3allio.py example

Hello, I am fairly new to LabJack and am attempting to get started. I am using python 2.7 (Spyder IDE). I followed the instructions for setting up the U3 via command prompt. Everything runs smoothly until I want to run one of the example codes. I am attempting to run the example u3allio.py and no matter what IDE (even tried the command prompt window), I get the following error:

    numChannels = int(sys.argv[1])

IndexError: list index out of range

Have I missed something in the documentation somewhere that is meant to get me over this speed bump? I have not modified anything in anyway from the example code. Also I am operating on Windows. I have tried using Spyder, Pycharm, and the command prompt to get this moving forward and end up with the same error in all 3. Thank you in advance. 

LabJack Support
labjack support's picture
That example requires an

That example requires an argument (integer value) which specifies the number of analog input channels to use. So in command line it would be this to use 2 analog inputs:

python u3allio.py 2

The newer version on GitHub makes this more clear:


Alternatively, modify the code:

numChannels = int(sys.argv[1])

And hard code the number of channels:

numChannels = 2  # Using 2 analog input channels