Question

I'm in the process of migrating a blog from Wordpress to Octopress. As a part of this process, I'm using a tool called exitwp to convert all Wordpress content to Markdown files.

I've followed the exitwp setup instructions and installed all the requirements. Python was installed using homebrew; the Python modules were installed with pip. I'm on a Mac with OS X 10.9.

$ which python

/usr/bin/python

$ pip install --upgrade -r pip_requirements.txt

Requirement already up-to-date: html5lib==1.0b1 in /usr/local/lib/python2.7/site-packages (from -r pip_requirements.txt (line 1))
Requirement already up-to-date: beautifulsoup4==4.2.0 in /usr/local/lib/python2.7/site-packages (from -r pip_requirements.txt (line 2))
Requirement already up-to-date: PyYAML==3.10 in /usr/local/lib/python2.7/site-packages (from -r pip_requirements.txt (line 3))
Requirement already up-to-date: html2text==3.200.3 in /usr/local/lib/python2.7/site-packages (from -r pip_requirements.txt (line 4))
Requirement already up-to-date: six in /usr/local/lib/python2.7/site-packages (from html5lib==1.0b1->-r pip_requirements.txt (line 1))

$ pip show PyYAML

Name: PyYAML
Version: 3.10
Location: /usr/local/lib/python2.7/site-packages
Requires: 

$ python -c "import sys; print sys.path"

['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']

When I run exitwp, I get the following error:

$ cd ~/code/exitwp/
$ python exitwp.py

Traceback (most recent call last):
  File "exitwp.py", line 10, in <module>
    import yaml
ImportError: No module named yaml

My thoughts are that this might have something to do with Python coming pre-installed with OS X, and that I have installed a newer version of Python via homebrew. I'm not very experienced with Python and pip, so I'm having some problems getting to the bottom of this.

It would be greatly appreciated if anyone could point me in the right direction.

Was it helpful?

Solution

Your python executable searches in /System/Library/Frameworks... for modules. pip installed your modules to /usr/local/lib/python2-7/site-packages though

A quick and dirty solution would be do simply add /usr/local/lib/python2.7/site-packages to your PYTHONPATH:

PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH python exitwp.py
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top