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

Python not finding interperter

asked 2016-01-07 20:57:25 -0500

AgentNoise gravatar image

I created a very simply hello world node in python. Though I can not get rosrun to execute because the python script will not find the interpreter. When I run whereis python the first path I get it /user/bin/python3.4m. There are several more bin paths listed and I have tried them all. Not sure why it wont find it. See the whereis and code below

Code

    ! /user/bin/python3.4m
import rospy
from std_msgs.msg import String

def talker():
pub = rospy.Publisher('hello_pub',String,queue_size=10)
rospy.init_node('hello_world_publisher',anonymous=True)
r = rospy.Rate(10) #10hz

while not rospy.is_shutdown():
str = "hello world %S"%rospy.get_time()
rospy.login(str)
pub.publish(str)
r.sleep()

if__name__=='__main__':
try:
talker()
except rospy.ROSInterruptException:pass

whereis

! /user/bin/python3.4m
import rospy
from std_msgs.msg import String

def talker():
pub = rospy.Publisher('hello_pub',String,queue_size=10)
rospy.init_node('hello_world_publisher',anonymous=True)
r = rospy.Rate(10) #10hz

while not rospy.is_shutdown():
str = "hello world %S"%rospy.get_time()
rospy.login(str)
pub.publish(str)
r.sleep()

if__name__=='__main__':
try:
talker()
except rospy.ROSInterruptException:pass
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-01-07 21:14:52 -0500

ahendrix gravatar image

On most standard Linux/Mac/POSIX systems, python will be in /usr/bin (no e).

The scripts you've posted are also missing the leading # which informs the OS that the first line defines the interpreter to be used. Try using this as the first line of your program instead:

#!/usr/bin/python3.4m
edit flag offensive delete link more

Comments

Oh, that was so obvious. Need to pay more attention. Thank you.

AgentNoise gravatar image AgentNoise  ( 2016-01-07 21:51:52 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-01-07 20:57:25 -0500

Seen: 137 times

Last updated: Jan 07 '16