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

Revision history [back]

As part of my GSoC project, I had researched and resolved the same problem. My findings and solutions are mentioned in my GSoC blog post

For completeness, I will cover the main points here.
When you invoke the script via flask and apache2, the ~/.bashrc does get sourced but suffers an early exit due to the following lines-

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

You're running it using a non-interactive terminal. Thus "$PS1" is not set.

The bash script you mentioned in the other answer is quite acceptable but it's useful to know the root of the problem. I have included more links in my blog post if you'd like to understand this better.