Sublime Forum

Selecting version of Python

#1

I’m trying to make a plugin that uses Berkeley DB through the bsddb bindings and I’m getting this error:

File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/bsddb/__init__.py", line 64, in <module> import _bsddb ImportError: No module named _bsddb

After Googling around, it’s apparently due to a problem with the default installed Python on Mac OS. So I installed a Python from MacPorts which fixes this issue, but I can’t get Sublime to use it. Is it possible to make it use a different Python framework?

0 Likes

#2

Or alternatively, how do I install a Python module such that Sublime will find it? I tried LevelDB as an alternative to BerkeleyDB, and its source package comes with a setup.py, but when I ran “python setup.py install”, it put it in a location accessible to the “python” interpreter, but not to the Sublime console.

0 Likes

#3

Why not use sqlite3? That seems to be importable just fine in the Sublime Text 2 console.

0 Likes

#4

I’d prefer to have the performance of a pure key-value store, and to not have to build strings of SQL queries.

0 Likes

#5

Ive added a few lines to my Python.sublime-build file for this same reason. Its pretty straight forward.

PATH_TO_INSTALL\Sublime Text 2 Build 2165 x64\Data\Packages\Python\Python.sublime-build

Here is my Python.sublime-build file below. I just uncomment/comment the versions as I need them.

{
// LOCAL
//“cmd”: “c:/python25/python.exe”, “-u”, “$file”],
//“cmd”: “c:/python26/python.exe”, “-u”, “$file”],
//“cmd”: “c:/python27/python.exe”, “-u”, “$file”],
//“cmd”: “c:/python32/python.exe”, “-u”, “$file”],
// PORTABLE
//“cmd”: “G:/app/python2.6.1/App/python.exe”, “-u”, “$file”],
//“cmd”: “G:/app/python2.7.2.1/App/python.exe”, “-u”, “$file”],
//“cmd”: “G:/app/python3.2.1.1/App/python.exe”, “-u”, “$file”],
// CUSTOM PORTABLE
//“cmd”: “G:/app/python26/python.exe”, “-u”, “$file”],
“cmd”: “G:/app/python27/python.exe”, “-u”, “$file”],

"file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"

}

0 Likes