yum install error File “/usr/bin/yum”, line 30 except KeyboardInterrupt on Cent OS Ubuntu Linux Mint Redhat

This is a common problem if you updated your python distribution to python 3. Normally installed python from source.


Unfortunately yum still depend on the python 2

What you need to do is:

$which python

Then navigate normally to:

$cd /usr/bin/

$ll | grep python

and see what is happening:

lrwxrwxrwx    1 root root           9 Feb 22 17:10 python -> python2.6
lrwxrwxrwx    1 root root           6 Nov  9 12:04 python2 -> python
-rwxr-xr-x    1 root root        9032 Jul 10  2013 python2.6

In my case I have already fixed this problem so you can see that my symlink python -> python2.6

if it point to something else then you need to type in:

ln -s python2.6 python

You can use any other version of python you have got installed as long as it is version 2


How to remove files using Python (File Remover program included)

1. Problem Description:

After doing some recovery from hard drive the software has created thousand of files which I didn’t needed.

Around 200k txt files . Removing that huge number of files using Windows is very painful because the Windows Explorer crashed. Bill Gates can’t handle it!!!

So I have write some basic script to do it for me:

2. Program (use it at your own risk )

Program goes through  all files in specifies directory and remove specific file types eg: .txt – text file.

You can run this program from Python Gui

import os


def file_remove(extension,indir):
counter = 0
for root, dirs, filenames in os.walk(indir):
for f in filenames:
full_path = root + “\\” + f
if f[-3:] == extension:
counter = counter + 1
print(“Removing ” + full_path)
print(“Removing type: ” + extension +” Number of files removed: “+ str(counter))


Django DatabaseError: no such column error

This is because you have amended your models and you have not changed your database.

Nothing to worry about!

For your info – > python manage.py syncdb ->  will NOT alter the existing schema in the database.

You need to run the python manage.py sqlall <your_app>

and then change your database based on the info given.

You may want to run python manage.py dbshell to do so

Or you can start using the Django addons calles South.


-> pip install South

-> Open up your apps -> settings.py

->add ‘South’ to your INSTALLED_APPS

-> run python manage. syncdb

-> then run python manage.py schememigration [yourapp_models] –initial

-> and again python manage.py migrate [yourapp_models]


Did it resolve your problem?

Let me know post your comments !!

SSD Hosting for 5 dollars a month https://www.digitalocean.com/?refcode=71a52388956e

Error detected while processing function pymode#Option:

rror detected while processing function pymode#Option:
line 8:
E121: Undefined variable: g:pymode_syntax
E121: Undefined variable: g:pymode_options
E121: Undefined variable: g:pymode_doc
E121: Undefined variable: g:pymode_lint
E121: Undefined variable: g:pymode_rope
E121: Undefined variable: g:pymode_run
E121: Undefined variable: g:pymode_breakpoint
E121: Undefined variable: g:pymode_utils_whitespaces
E121: Undefined variable: g:pymode_folding
Error detected while processing /home/honghe/.vim/bundle/python-mode/after/inden
line 1:
E121: Undefined variable: g:pymode_indent
E15: Invalid expression: pymode#Default(‘b:pymode_indent’, 1) || !g:pymode_inden
Error detected while processing function pymode#Option:
line 8:
E121: Undefined variable: g:pymode_syntax


Install Python 2 as well 🙂 together with Python 3
If you have got Python 3 installed it will gives you these errors.

How to Install Django

Install Setuptools first

Mac OS

> wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O – | python


Note that you will may need to invoke the command with superuser privileges to install to the system Python.

Alternatively, on Python 2.6 and later, Setuptools may be installed to a user-local path:

> wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
> python ez_setup.py –user

Install Pip

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py

$ python get-pip.py


Using Package Managers

On Linux, pip will generally be available for the system install of python using the system package manager, although often the latest version lags behind. Installing python-pip will also install python-setuptools.

On Debian and Ubuntu:

$ sudo apt-get install python-pip

On Fedora:

$ sudo yum install python-pip

Then Install Django: ( You can check the latest version on https://www.djangoproject.com/download/)

pip install Django==1.5.5

Now you are ready to rock!

Recipe for Designing Functions in programming languages

Recipe for Designing Functions:

1. Examples
    What should your function do?
    Type a couple of examples calls.
    Pick a name (often a verb or verb phrase):
    What is a short answer to “What does your functions do?”
2. Type Contract
    What are the parameter types?
    What type of value is returned?
3. Header
    Pick meaningfull parameters names.
4. Description
    Mention every parameter in your descriptions.
    Describe the return value.
5. Body
6. Test
    Run the examples

Python Programming Keyboard shortcut for accessing previous statement in IDLE

I hope this helps you to learn programming in Python. I found out that this is quite useful not it does not get mentioned in books.


alt + p = previous statement


alt +n  = next statement

On Mac:

ctrl + p = previous statement


ctrl +n  = next statement


Have fun!