I'm using the PXfmini with the raspberrypi3 for a project and I need to use mavros and python code. My operative system is Frambuesa. I created the catkin workspace and I tested the c++ file takeoff_land_ and it works very well.

Now I need to test the python code, because I have to work with it, I’m using this example and I followed all the instructions to compile the statusleds.py :


But this is the error that the screen showed me:


How can I fix this?

I already tried this commands: Access GPIO pins without root. No access to /dev/mem. Try running as root!

thank you :)

  • To confirm, have you tried running it as root as suggested (sudo rosrun ...)? What happens if you do that?
    – Aurora0001
    Oct 24, 2017 at 16:01
  • sudo rosrun ros_erle_statusled statusleds.py [sudo] password for erle: sudo: rosrun: command not found
    – flavia13
    Oct 24, 2017 at 16:11

1 Answer 1


Raspbian supports the /dev/gpiomem device which allows access to the GPIO without being the root user.

If /dev/gpiomem does not exist on your system you will need to run the Python script as the root user (with all the risks that entails).

  • But when I write: sudo python statusleds.py Traceback (most recent call last): File "statusleds.py", line 2, in <module> import rospy ImportError: No module named rospy
    – flavia13
    Oct 24, 2017 at 16:13
  • That is a path problem. You need to install rospy in a standard location so that it is in the path of the root user.
    – joan
    Oct 24, 2017 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.