Ask Your Question
2

Calling a python script with ROSRUN

asked 2013-02-28 07:22:30 -0500

Victor_ocv2 gravatar image

updated 2013-02-28 07:23:30 -0500

Hello,

I have seen that you can call python scripts with rosrun, i.e.:

rosrun tf2_tools view_frames.py

and I have been trying to setup my project so that I can call a python script in the same way:

rosrun myproject mypythonscript.py

following the structure of the tf2_tools project, I have created a folder named scripts in the myproject, but I can not yet call that script using rosrun.

What else do I have to do? Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
8

answered 2013-02-28 07:26:11 -0500

First, make sure the python script is executable (chmod +x mypythonscript.py).

Next, make sure you have a shebang line at the top of the script that looks like #!/usr/bin/env python.

edit flag offensive delete link more

Comments

It works now, thank you! I did not had a blank at the shebang line >.<

Victor_ocv2 gravatar image Victor_ocv2  ( 2013-02-28 07:29:07 -0500 )edit

For me, it was a problem of file format (between unix and dos format). Explainations here I ran the command : 'dod2unix mypythonscript.py' and the rosrun command did work then.

Luczia gravatar image Luczia  ( 2015-01-17 15:00:49 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-02-28 07:22:30 -0500

Seen: 22,298 times

Last updated: Feb 28 '13