Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"TypeError: unsubscriptable object", python [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Fri Sep 01, 2006 8:59 pm    Post subject: "TypeError: unsubscriptable object", python [SOLVE Reply with quote

With something like:
Code:
raw_pcklist = commands.getstatusoutput('equery l')
   if raw_pcklist[0] == 0:
      pkglist = raw_pcklist[1].split()
      for pkg in pkglist:
         print pkgsplit(pkg)[0]

I receive this error
Quote:
print pkgsplit(pkg)[0]
TypeError: unsubscriptable object

But using, for example...
Code:
         print pkgsplit('x11-wm/metacity-2.14.5')[0]

It works!!! :?:

The pkg variable is a string cointains something like x11-wm/metacity-2.14.5
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic


Last edited by mrfree on Sat Sep 02, 2006 2:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
mrfree
Veteran
Veteran


Joined: 15 Mar 2003
Posts: 1303
Location: Europe.Italy.Sulmona

PostPosted: Sat Sep 02, 2006 2:02 pm    Post subject: Reply with quote

Oops!!! I pass wrong parameters to equery... all work now, I'm now using a better regular-expression based string analyzer
_________________
Please EU, pimp my country!

ICE: /etc/init.d/iptables panic
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum