adam
June 11, 2014, 2:05am
1
Update: With some help from friends, I hacked together a solution.
First, I ran pip show --files sendwithus
from the terminal
This was the output:
Then, I took that “Location” info and manually appended it to the path in the beginning of my code:
import sys
print sys.path
sys.path.append('Users/MacBookAir/anaconda/lib/python2.7/site-packages')
import sendwithus
#the rest of my code
Finally worked!
My original explanation of what I did:
What I’ve done so far:
I used PIP to install a module, sendwithus
When I tried using the package:
import sendwithus
#my_code
I got this error: ImportError: No module named sendwithus
I manually added the path in Komodo (Komodo >> Preferences >> Python >> +)
Komodo >> Preferences
Python
4.Now, Komodo recognizes the package and finds it on the drop-down
5.And yet, I’m still getting the same error.
6.So, I went and tried to append the path using sys.path, thinking maybe it was an issue there.
My code:
import sys
print sys.path
sys.path.append('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages')
8.No dice. The problem remains.
ImportError: No module named name_of_module
toddw
June 11, 2014, 7:15pm
2
Could it be that Komodo and your terminal were using different Python’s?
I.e. one was using ActivePython, one was using the Mac system Python.
adam
June 11, 2014, 11:28pm
3
Not sure! How do I check?
toddw
June 11, 2014, 11:57pm
4
In the terminal, type:
which python
and in Komodo, check in the Python preferences page and click on the Use this interpreter menulist - the first Python interpreter is what Komodo uses when it’s set to Find on Path .
adam
June 12, 2014, 12:15am
5
Here’s the output:
and
Should I change from “Find on Path” to “user/bin/python” ?
Will that break (or fix) my ability to use PIP?
Sorry if these are noob questions.
adam
June 12, 2014, 12:16am
6
Re-reading your answer.
Nevermind, looks like it’s defaulting to “user/bin/python” already since that’s the first one on the list.
toddw
June 12, 2014, 4:02pm
7
It’s best to use the same interpreter (i.e. /Users/Macbook/Air/anaconda/bin/python ) in both terminal and Komodo - as that way any python libraries installed by pip on the command line (assuming pip is setup for anaconda/bin/python) should be available to Komodo automatically (for code intelligence and debugging) without having to manually adjust the Python sys.path in your code.
Cheers,
Todd
adam
June 12, 2014, 4:54pm
8
That makes sense! I get that.
How do I do it?
adam
June 12, 2014, 4:58pm
9
Never mind, didn’t see the browse button!