[SOLVED]Python bitstrings

Posted on
Sat Jan 04, 2014 12:28 am
cec offline
Posts: 7
Joined: Feb 27, 2012

[SOLVED]Python bitstrings

Hi-
I'm using Python-bitstring (https://code.google.com/p/python-bitstring/) and my code works fine with python, but when I try to execute via indigohost -x I get an error saying "ImportError: No module named bitstring"

Any suggestions?
Thanks-

Posted on
Sat Jan 04, 2014 11:24 am
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python bitstrings

How did you install that library? Indigo uses Python 2.5 (for a variety of reasons) but it's not the default Python install on the more recent OS releases. So, if you used pip or easy-install then it installed it for the default version.

If you're going to use it in a plugin that others will use then you'll want to include it with the plugin - just add the module to the Contents/Server Plugin folder.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jan 04, 2014 11:45 am
cec offline
Posts: 7
Joined: Feb 27, 2012

Re: Python bitstrings

Hi Jay-
I'm on a Mac using Python 3, and noticed Indigo uses 2.5. The bitstrings doc says to use v1, so I uninstalled (via pip) bitstrings (which had defaulted to the latest for Python 3) then did an install forcing version 1.0.2 - still got the same error though. I am not expert at managing python installs, though.

I may make the code a plugin after more debugging and cleaning up, but for now I'm just trying to make it work on my machine.

For context, I'm running a Python server on the Mac that runs my Indigo6 server. The Python server listens to arduino-hosted sensors via xbee radios and serial comm), updates variables in Indigo, and logs data to Thingspeak.com. (all of this to learn enough about the normal duty cycles of sump pump and furnace so that I can watch for leading indicators of problems)

CeC

Posted on
Sat Jan 04, 2014 6:37 pm
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Python bitstrings

Your pip install is in another version of Python on your Mac - probably the default one. Asking for it's version will tell you:

Code: Select all
$pip -V
pip 1.4.1 from /Library/Python/2.6/site-packages (python 2.6)


So the version of pip I have installed and in my path is using Python 2.6 - because the default version of Python on Lion is 2.6. pip will then install any libraries it manages into the appropriate directories for Python 2.6.

What you'll need to do is either install your library some other way (not using pip) or install pip in your Python 2.5 installation. You can download 1.3.1 of pip (the last version that supported Python 2.5) and then when running the setup use python2.5 rather than python on the command line - that should force the setup scripts to run in the 2.5 installation. There may be a few other bumps since I haven't done it before, and there are some requirements for pip so you'll need to look at the pip install docs to get those installed as well.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests