juntalis - 2011-03-31

So I ran into an issue the other day where I went to use PythonScript and noticed the console littered with errors. It was still workable, mind you, but the red kind of annoyed me so I check it out and found out that when PythonScript was importing site, it was also importing the site directory of my real Python 2.7 installation, and when it went to import pygtk, it would throw an error.

Anyways, I wrote a fix in my system startup.py script and decided I'd post it just in case anyone else runs into this issue.

# Fix for some sys.path conflicts when user has an existing python 2.7
# installation.
newPath = []
for pth in sys.path:
    if (pth.count(notepad.getNppDir()) > 0) or (pth.count(notepad.getPluginConfigDir()) > 0):
sys.path = newPath

Place that in your system startup.py script right above the following lines:

# This imports the "normal" functions, including "help"
import site