Ask Your Question

'type' object is not subscriptable

asked 2012-07-23 07:02:07 -0500

punching gravatar image

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

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 imageLorenz ( 2012-07-23 07:41:16 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

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

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 -0500

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 imageEric Perko ( 2012-07-23 10:24:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools


Asked: 2012-07-23 07:02:07 -0500

Seen: 1,233 times

Last updated: Jul 23 '12