TIP: Fixing Yum Search Error in Fedora 6

You are using Fedora Core 6, try to “yum search” a package and get a bunch of python errors like the following:

# yum search graden
Loading "installonlyn" plugin
Setting up repositories
Reading repository metadata in from local files
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.main(sys.argv[1:])
File "/usr/share/yum-cli/yummain.py", line 94, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 356, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File "/usr/share/yum-cli/yumcommands.py", line 336, in doCommand
return base.search(extcmds)
File "/usr/share/yum-cli/cli.py", line 895, in search
for (po, matched_value) in matching:
File "/usr/lib/python2.4/site-packages/yum/init.py", line 1136, in searchGenerator
value = po.returnSimple(field)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 68, in returnSimple
self.simple[varname] = r[0]
TypeError: unsubscriptable object

(Possible) Cause: Corrupt yum cache
Solution: Delete cache with rm -rf /var/cache/yum/*

At least it worked for me ;-)