Posted by gianecri2
What steps will reproduce the problem? webiopi start error WebIOPi version used? =>0.7 Python version used?=>3.2 Distro used? =>Raspbian Wheezy
Hi, I've made a small porting in order to use Adafruit_CharLCDPlate with python 3. The LCD software alone is now working, but when I put the code into my custom webiopi script (script.py) at start I get "...from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate ImportError: No module named Adafruit_CharLCDPlate" Adafruit_CharLCDPlate.py is in the same folder of script.py. I've added also an empty __init__.py file to this folder but nothing happens ... I'm a little bit frustrated. If I run script.py from command line..it works! Please, can someone help me and my old old brain? Thanks in advance. Gian.
Posted by andreas.riegg
First, thanks for your contribution.
It does not work from within WebIOPi custom script because WebIOPi uses the Python package installation setup mechanism that precompiles all WebIOPi code and puts it in a Python module library (using setup.py). When running WebIOPi the standard way, this is done by using the module calling start of Python (see webiopi.sh). The whole Adafruit stuff is just not in the precompiled library and so the import fails. You could fix that by adding the Adafruit stuff, but you will do this at your own "risk", we can't give you support if anything fails or does not work stable.
The Adafruit stuff uses its own I2C bus access code (for the MCP23017 chip). While this may work it could have unforseen interferences with the WebIOPi I2C access code, so this is from my point of view a no-go as two libraries are mixed together that were never (and will never) be intended to do so.
For good reasons, it is the official policy of WebIOPi to have no dependencies on any 3rd party components or libraries. So the point 2 is a violation of this rule.
So, you may be able to run this by modifying the package list, but this is a very ugly solution. Better would be to use the existing WebIOPi I2C driver for the MCP chip and rewrite the whole Adafruit stuff to use the mcp instance. This is what Eric has done when implementing the PiFace shield driver, you may look there. However, looking at the Adafruit code, there are many I2C calls in there, some with maybe critical timing/polling so this won't be an easy 10 minutes task. Plus, writing a WebIOPi device driver needs additional skills ...
So at least you are informed what is the case.
Posted by gianecri2
Hi, thanks a lot for your detailed answer. I'm a little bit sad about a quick solution to my problem. This week I'll try to test if webiopi and Adafruit i2c can run toghether. Not the best solution of course but if it works.... :-) Otherwise I'll add a second pi to manage front-end interaction with lcds.
Posted by JoeyPongallo
If you cant import other libraries like smbus, than this webiopi isn't ready to be realeased...