Yum Error

I struggled a long time doing lotsa googling and opening up books to get hold of this error.

I faced this error while using YUM in some versions of linux, the error looks as below:

Traceback (most recent call last):
File "/usr/bin/yum", line 6, in ?
import yummain
File "/usr/share/yum-cli/yummain.py", line 23, in ?
import yum
ImportError: No module named yum

Now after lots of search i managed to find the reason and a workaround for it:

This error is caused because yum installs the python modules in: /usr/lib/python2.3/site-packages and some versions of RHEL uses python2.2.

To make yum work we only have to tell python to search for modules in this new directory using the variable PYTHONPATH.

I just did: (ofcourse here i am using bash shell)
#export PYTHONPATH=/usr/lib/python2.3/site-packages
And then used the yum command
#yum list all

booom.. here it worked like magic.. so thats my take on this error if you have any suggestions on this please feel free to post.