Script doesn't work when rosrun but does with just python

Hello,

I am pretty sure this is a result of my package not working fully but I can’t figure out how to fix it. I am in unit 4.

I have copied the simple service servicer as shown in the lesson. However, when I do rosrun my_examples_pkg simple_service_server.py and then rosservice list in the other terminal the service doesn’t show up. However, if I start the service like this: python simple_service_server.py then the service can be found using the list command.

I have run catkin_make from /catkin_ws and it has not solved the problem.

The rosrun command acts like it knows the files and package names as it will autofill with tab.

Any help is appreciated!

Did you include in the first line this sentence:
#! /usr/bin/env python
??

1 Like

That was it! Thank you. Do you know why that line is so important since it is commented out?

1 Like

Take a look at:


and
1 Like