sudo can't find rospy
We are trying to run a publisher/subscriber on a raspberry pi.
The talker captures keyboard input and the listener takes the key presses and controls LEDs connected to the RasPi pins.
Everything seems to be working fine except for one annoying error.
The listener needs to be run using sudo so it can control the pins.(More info here: https://www.raspberrypi.org/forums/vi... ) But when I run the listener using sudo, I receive the error "no module named rospy". Rospy works fine when I run the listener without root.
the two commands I'm running are:
python listener2.py
sudo python listener2.py
Is there something else I should be running instead of sudo python?
Thanks!
Related: Rosrun as super user.