Bug: incorrect python sys.path

Bug: incorrect python sys.path

So we happily upgraded a project to use some newer version of libs, and got it to use virtualenv. Until when I made changes, I found the new code doesn't make any difference. After some boring investigation I found the staging site is importing code from production site, so new code added to staging site is simply ignored. It's really important to avoid messing up with sys.path too much, like "sys.path.append('/path/to/live/site')". And when it is needed, make it dynamic path rather than hard coded. 

After fixing the hard coded path in the code, the issues remain. It proved to be /the-viertualenv/lib/python2.6/site-packages/easy-install.pth at last, some paths, somehow got added to this file. 

I never knew that easy-install.pth would also change sys.path. Something to read about the .pth files

Update: the built-in site lib can also be used to change your sys.path, example: 

import site