spidev python on jetson tx2

Hi team,
I’m doing something very simple (in appearance), which is running this code on python3 :

import spidev
SPI = spidev.SpiDev()
SPI.open(0, 1)

then I get :
FileNotFoundError: [Errno 2] No such file or directory: ‘/home/nvidia/’

I have spidev installed as per another article on devtalk.nvidia.com, so if I do ls /dev/spidev

lsmod | grep spi
spidev 9920 0
nvidia@tegra-ubuntu:/sys/class/spidev$ ls /dev/spidev*

This is on a TX2… what do you recommend I take a look at?


I’m getting this error message when running through vscode (via remote debug), and also when running directly locally in interactive python… so it’s not related to vscode or ptvsd.

I just realized that my could should instead be this :

import spidev
SPI = spidev.SpiDev()
SPI.open(3,0) # versus SPI.open(0,1).

I believe that to be because the spi I’ve been using is listed under /dev/spidev3.0. So had to give the permissions to the device for the user running python and at least now I can try moving to the next phase of my project!