akipta / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 0 forks source link

Adafruit_CharLCDPlate #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by gianec...@gmail.com on 6 May 2014 at 10:09

Attachments:

GoogleCodeExporter commented 9 years ago
Gian,

First, thanks for your contribution.

Three remarks:

1. 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.

2. 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.

3. 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.

Andreas

Original comment by andreas....@googlemail.com on 7 May 2014 at 8:09

GoogleCodeExporter commented 9 years ago
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. 

Original comment by gianec...@gmail.com on 12 May 2014 at 10:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
If you cant import other libraries like smbus, than this webiopi isn't ready to 
be realeased... 

Original comment by JoeyPong...@gmail.com on 25 Oct 2014 at 1:55