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

'type' object is not subscriptable

asked 2012-07-23 07:02:07 -0600

punching gravatar image

updated 2014-01-28 17:13:07 -0600

ngrennan gravatar image

I have a node that is a service that lists wifi access points and their details. When I first run rosrun there's no errors. Then I make a service request and it says Error processing request: 'type' object is not subscriptable. I'm sure it's a basic Python error but I can't figure out what it is. Thanks!

The relevant code:


  return WifiListResponse[String(ssid_list), UInt8(strength_list), Bool(secured_list)]

my .srv file:

int8 request
string[] ssid_list
uint8[] strength_list
bool[] secured_list
edit retag flag offensive close merge delete



Unfortunately, I think the code you pasted is not enough to infer what's going wrong. Please paste the complete relevant code not just snippets that don't contain any context. Also, please copy-paste the complete backtrace.

Lorenz gravatar image Lorenz  ( 2012-07-23 07:41:16 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-07-23 08:09:01 -0600

Eric Perko gravatar image

Your code is not valid Python.

Try something like

WifiListResponse(ssid_list, strength_list, secured_list)
edit flag offensive delete link more

answered 2012-07-23 10:07:33 -0600

punching gravatar image

I tried that but I had somehow put in [ instead of (.

Eric, what you posted worked. Thanks. Sometimes you can't see the trees through the forest!

edit flag offensive delete link more



Please use the comment function instead of posting a new answer. Also, if your question is solved, make sure to mark the correct answer as "Accepted" using the checkmark undernearth the voting buttons.

Eric Perko gravatar image Eric Perko  ( 2012-07-23 10:24:17 -0600 )edit

Question Tools


Asked: 2012-07-23 07:02:07 -0600

Seen: 4,770 times

Last updated: Jul 23 '12