Python is perhaps the most the productive programming language for widely use ( Happy Chinese Snake Year). Now the vim plugins could be written with python.
For version or platform reason, sometimes the vim could not get the right version for python lib.
I got a importError for python when run vim with a plugin as:
File “<string>”, line 2, in <module>
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py”, line 94, in <module>
import httplib
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py”, line 79, in <module>
import mimetools
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py”, line 6, in <module>
import tempfile
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py”, line 34, in <module>
from random import Random as _Random
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py”, line 47, in <module>
from os import urandom as _urandom
ImportError: cannot import name urandom
This could happen on my iMac. For macvim, to solve this is just (assume there is hombrew installed):
brew unlink python
brew unlink macvim
brew remove macvim
brew install -v –force macvim
brew link macvim
brew link python
For the vim, the funny thing is : the vim coming with mac did not support python well ( /etc/bin/vim), if you install vim using brew( /etc/local/bin/vim), then this one could work with python. My solution is just modify the PATH, by edit the file /etc/paths. Place /etc/local/bin ahead of /etc/bin/, Then when running vim, the available one could work with python very well.