ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I would do what @NEngelhard suggests, but just to answer your question: you need to run your Python script in an environment that has been setup with the ROS environment variables.

Two ways to do that:

  • start your script from a terminal in which you've sourced the right setup.bash
  • setup the environment which is created by os.system(..) with the needed environment variables

If you do want to continue starting ROS command line utilities, I'd recommend you use subprocess or popen instead of os.system(..).