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

Roslaunch got a 'No such file or directory' error

asked 2018-11-17 19:39:32 -0600

Sparkle Eyes gravatar image

Dear Community,

Here is a bug I've been trying to debug for hours. I was following tutorial from the book "ROS robotics projects" to build a chatbot with python AIML package.

Here is the link to my source code: https://github.com/yuqli/rosproj/tree...

Here are the steps I have been following:

  • I initialized workspace in the ./src folder under root folder (which is named cb in this case)
  • I build the workspace in the root folder.
  • I go back to the ./src folder and created a package named "ros_aiml" there.
  • Within package "ros_aiml", I have the following files - which you could inspect in the github..

Files include 1) data, 2) source code and 3) launch files.

Data are in the data folder, which contains pre-downloaded rules for answering questions.

Regarding source code in the ./src folder, there are four files: 1) aiml_client.py 2) aiml_server.py 3) aiml_tts_client and 4) aiml_speech_recognition_client. They are organized around two topics:

  • /chatter: aiml_client and aiml_speech_recognition_client both publish to this topic. the former will wait for user input and then publish, while the latter will translate user's speech into text and then publish. In both cases, the content is user input which is a question. aiml_server subscribes to this topic.
  • /response: aiml_server publishes to this topic. the content is the answer to the user input question. aiml_tts_client subscribes to this topic, which will later translate the text to speech.

Launch files:

  1. start_chat.launch will launch the aiml_server and aiml_client nodes.
  2. start_tts_chat.launch will launch the aiml_server, aiml_client and aiml_tts nodes. This is an upgrade of the first launch file as it will translate the answer text into speech.
  3. start_speech_chat.launch will launch the aiml_server, aiml_tts_client, aiml_speech recognition nodes.

So my problem is, when trying to run `roslaunch ros_aiml start_chat.launch", I got this error. What went wrong? I did chmod u+x all the executable .py and .launch files.

yuqiong@yuqiong-G7-7588:/media/yuqiong/DATA/rosproj/cb/src/ros_aiml$ roslaunch ros_aiml start_chat.launch
... logging to /home/yuqiong/.ros/log/e5a30fd0-eacb-11e8-a856-645d867d07a8/roslaunch-yuqiong-G7-7588-12518.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://yuqiong-G7-7588:40753/

SUMMARY
PARAMETERS
 * /aiml_path: /media/yuqiong/DA...
 * /rosdistro: kinetic

 * /rosversion: 1.12.14

NODES
  /
    aiml_client (ros_aiml/aiml_client.py)
    aiml_server (ros_aiml/aiml_server.py)
auto-starting new master
process[master]: started with pid [12528]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to e5a30fd0-eacb-11e8-a856-645d867d07a8
process[rosout-1]: started with pid [12541]
started core service [/rosout]
process[aiml_server-2]: started with pid [12548]
Roslaunch got a 'No such file or directory' error while attempting to run:

/media/yuqiong/DATA/rosproj/cb/src/ros_aiml/src/aiml_client.py __name:=aiml_client __log:=/home/yuqiong/.ros/log/e5a30fd0-eacb-11e8-a856-645d867d07a8/aiml_client-3.log

Please make sure that all the executables in this command exist and have

executable permission. This is often caused by a bad launch-prefix.
The traceback for the exception was written to the log file
[aiml_client-3] killing on exit
[aiml_server-2] killing on exit
Traceback (most ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2018-11-18 04:47:30 -0600

gvdhoorn gravatar image

updated 2018-11-18 04:48:40 -0600

The problem is with the contents of your Python files, not with ROS, roslaunch or your workspace.

Looking at src/aiml_client.py (I haven't checked the other files), we see:

#!usr/bin/python2
import rospy
from std_msgs.msg import String
...

The issue is with the first line: #!usr/bin/python2.

The shebang should be followed by the path to an interpreter for the file, in your case the Python interpreter. The binary for that (python2 in this case) is typically located in /usr/bin, but this line is missing the first forward slash (/) making it a relative path.

As all ROS nodes have their cwd set to $HOME/.ros at launch the relative path to the interpreter is not a valid path and so roslaunch gets a "No such file or directory" and shows that to you.


Also:

I did chmod u+x all the executable .py and .launch files.

.launch files are not directly executable, so there is no point in setting the exec bit on them.


Edit: just checked the other scripts and all of them except aiml_server.py have an incorrect shebang line.

edit flag offensive delete link more

Comments

PS:

Here is a bug I've been trying to debug for hours.

This is not really a bug I believe. More a mistake in your files.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-18 09:27:06 -0600 )edit

Thanks so much for taking time to have a look! Yes the shebang line is the problem... Solved perfectly. Thanks!

Sparkle Eyes gravatar image Sparkle Eyes  ( 2018-11-18 11:02:41 -0600 )edit
0

answered 2020-12-17 18:15:58 -0600

Asker Of Questions gravatar image

I had this same issue when moving my package from melodic to noetic

it is this part below ROS has a problem with

#!usr/bin/python2

if you're running python3 you declare the path of pythong3 like so

!# /usr/bin/python3

this fixed the issue for me.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-17 19:39:32 -0600

Seen: 11,627 times

Last updated: Dec 17 '20