Windows10 rosrun couldn't find python scripts in path scripts.

asked 2019-06-17 23:52:04 -0500

张庆昊 gravatar image

I have run setup.bat

Such I have a package in root path named "test_pkg", and my python scripts in path test_pkg\scripts\talker.py

If I run rosrun test_pkg talker.py in cmd, I will got error "Couldn't find executable named talker.py"

Buf if I run rosrun test_pkg scripts\talker.py, it will work well.

It's a little inconvenient, could anyone tell me how to fix it? Thanks.

edit retag flag offensive close merge delete

Comments

Have you installed your Python script in your CMakeLists.txt file (search for catkin_install_python())? http://docs.ros.org/melodic/api/catki...

Sean Yen gravatar imageSean Yen ( 2019-06-18 01:36:28 -0500 )edit

@Sean Yen Can you give me some examples? I tried to add catkin_install_python(PROGRAMS test_pkg scripts/talker.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) in my CMakeLists.txt in path "test_pkg\". But I got error. I think I write it with wrong format. So. could you give some examples? Thanks a lot!.

张庆昊 gravatar image张庆昊 ( 2019-06-19 04:35:33 -0500 )edit

Can you share the error message you see? Most likely I would guess you should change the line to catkin_install_python(PROGRAMS scripts/talker.py DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) and then run catkin_make again.

Sean Yen gravatar imageSean Yen ( 2019-06-19 15:16:43 -0500 )edit

@Sean Yen catkin_python_setup() called with unused arguments: PROGRAMS;scripts/talker.py;DESTINATION

张庆昊 gravatar image张庆昊 ( 2019-06-19 20:13:13 -0500 )edit

My computer couldn't connent network, so I just type the main error message of the log, if you want to the whole log, I can take pictures for you. I'm sorry about that.

张庆昊 gravatar image张庆昊 ( 2019-06-19 20:19:38 -0500 )edit