0
$\begingroup$

Rosanswers logo

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

Originally posted by AgentNoise on ROS Answers with karma: 38 on 2016-01-07

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 

Originally posted by ahendrix with karma: 47576 on 2016-01-07

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by AgentNoise on 2016-01-07:
Oh, that was so obvious. Need to pay more attention. Thank you.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.