View previous topic :: View next topic |
Author |
Message |
mrfree Veteran
Joined: 15 Mar 2003 Posts: 1303 Location: Europe.Italy.Sulmona
|
Posted: Fri Sep 01, 2006 8:59 pm Post subject: "TypeError: unsubscriptable object", python [SOLVE |
|
|
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 |
|
|
mrfree Veteran
Joined: 15 Mar 2003 Posts: 1303 Location: Europe.Italy.Sulmona
|
Posted: Sat Sep 02, 2006 2:02 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|