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

AttributeError

asked 2012-11-23 19:34:48 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

hi i am trying to use the split command so that i can split the voice input but getting an error " AttributeError: 'NoneType' object has no attribute 'split' "

code snippet is

def talkback(self, msg):

command = self.get_command(msg.data)

# Print the recognized words on the screen
rospy.loginfo("Command: " + msg.data)
#rospy.loginfo(msg.data)

#some_str = command
#some_wrd = 'time'

if 'time' in command.split():
    msg.data = strftime("%H:%M:%S ")
    self.soundhandle.say(msg.data, self.voice)
elif 'name' in command.split():
    self.soundhandle.say("my name is atom", self.voice) 
else:
        return
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-11-23 20:46:58 -0600

Lorenz gravatar image

The variable command is probably empty, i.e. set to None.

edit flag offensive delete link more

Comments

hey thanks for the help. i have changed the code a bit and now it work fine for time but for name it don't any help

karan4515 gravatar image karan4515  ( 2012-11-23 21:04:15 -0600 )edit

Question Tools

Stats

Asked: 2012-11-23 19:34:48 -0600

Seen: 515 times

Last updated: Nov 23 '12