komodo edit won't recognize python packages on script execution but recognizes them in auto-complete

841 views Asked by At

I am trying to setup Komodo edit to run Python scripts on a new Mac running Mavericks. I installed the ActiveState version of Python (ActivePython 2.7.5.6) and some necessary packages to:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

To install the packages I used pip (pip install module) if it was possible. Otherwise I would use setup_tools, and the python setup script if the first two didn't work.

Komodo Edit's autocomplete also recognizes the packages (e.g. bitarray, Pycluster) and I can run the scripts using these packages from the terminal; however, when I execute the Python interpreter from Komodo Edit I get the following:

Traceback (most recent call last): File "/Users/stevensteinway/Desktop/t-02.py", line 1, in <module> import bitarray ImportError: No module named bitarray

Under Preferences --> Python I've imported specific directories and this still doesn't solve the issue:

`/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages`
`/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bitarray`

Does anyone have any idea why this is happening and how it could be fixed?

Thank you,

Steve

@martineau

I included the follow code:

import sys print sys.path

and got this output:

'/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']

The last folder is this: /Library/Python/2.7/site-packages

but I think it should be this:

‘/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages’

I entered it through the Komodo edit GUI (Preferences --> Languages --> Python) and the path I included is /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages seems to be truncated. Could this be the issue?

1

There are 1 answers

0
AudioBubble On

The site-packages folder that you're looking for is not under '/System', it's under '/Library'. Try what @martineau said but remove '/System' from the path.

import sys
sys.path.append('/Library/Frameworks/Python.framework/Versions/2.7/lib/p‌​ython2.7/site-packages')
# cross fingers
import bitarray