+1 I wonder if this could also be used to control which version of Python you are using without changing the paths and such. I have been working on making ros, ros_comm, and common_msgs more Python 2/3 portable because of MORSE, which uses Blender, which requires Python3. I had considered setting something like env['ROS_PYTHON'] and replacing the #!/usr/bin/env python lines with something like ros-shebang that would select python executables and paths based on the environment variable. This isn't something I see people doing often, but it might be a use case to consider when designing this tool. There might also be a better/existing way of doing what I am talking about, but I am just not aware of it. Looks good, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ William Woodall Graduate Software Engineering Auburn University w@auburn.edu wjwwood@gmail.com williamjwoodall.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Wed, Aug 10, 2011 at 11:21 AM, Ken Conley wrote: > +1 > > If shorter names are being debated, I offer 'rosbang'. The placement > of the hyphen in ros-shebang doesn't quite feel like a ros command > name. > > I should also note that part of this discussion also includes what > distributions ros-shebang should be included in, i.e. should it be > backported to diamondback, sneak in through the electric freeze, > etc... > > The hashbang spec has definitely been an impediment for having a good > ease-of-use with rosh, so I support at least having this in ROS > Electric. I'm indifferent to ROS Diamondback as my development is > always focused on the latest-and-greatest release. > > - Ken > > On Tue, Aug 9, 2011 at 2:40 PM, Thibault Kruse wrote: > > Hi, > > > > I would like to make a suggestion. > > > > I want to add a command (called ros-shebang for now) to ros/bin that runs > > script files by invoking a second shebang line. > > > > This allows invoking script interpreters with #! and passing additional > > arguments, as well as invoking interpreters that live in ROS packages. > > > > My stake is calling an interpreter for roslisp scripting. However a > > similar concern is invoking of rosh plugins, see > > http://www.ros.org/wiki/rosh/Overview/Roshlets > > > > Example for rosh: > > #! /usr/bin/env ros-shebang > > #! /usr/bin/env rosrun rosh rosh rosh/echolet.py > > --plugins=rosh_common,rosh_geometry > > > > Example for roslisp: > > > > #! /usr/bin/env ros-shebang > > ;; /usr/bin/env rosrun sbcl run-sbcl.sh --script > > > > One less known alternative is to use other directives to declare the > > script interpreter than #!, (in case you wonder, for lisp, #| and ":"; > > work) however this does not work with python subprocess.Popen, which > means > > roslaunch and rostest would fail to run scripts like that (except using > > shell=True, but this is strongly discouraged for security and portability > > reasons). > > > > Alternatives: > > - A modification to roslaunch syntax to allow forcing shell=true > > > > - an executable in ros/bin that executes roslisp scripts, such that we > > could write: > > #! /usr/bin/env ros-run-roslisp-script > > > > - A required fixed installation of our lisp implementation, or some > custom > > made variant of /usr/bin/env > > > > > > I wrote a ros-shebang script in python that works, which is no more magic > > than reading the second line and calling python execvp on it (minus the > > first two symbols). > > > > If a new command were introduced to ros/bin, this would affect more > people > > than those working with roslisp, so opinions should be heard. There is no > > urgency to this, roslisp works fine as it is without offering comfortable > > scripting, just as rosh works fine by loading plugins after the shebang > > line. > > > > Not sure if there are other scripting interpreter usages with similar > > issues in ROS (Java, Lua, Javascript, ...). > > > > Thoughts? > > > > Thibault > > > > _______________________________________________ > > ros-developers mailing list > > ros-developers@code.ros.org > > https://code.ros.org/mailman/listinfo/ros-developers > > _______________________________________________ > > ros-users mailing list > > ros-users@code.ros.org > > https://code.ros.org/mailman/listinfo/ros-users > > > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users >