Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Here is the script: https://github.com/iinnovations/iicontrollibs/blob/master/cupid/owfslib.py And the calling script (see line 123) https://github.com/iinnovations/iicontrollibs/blob/master/cupid/updateio.py Everything in the first script is debugged to not do anything except print the id of

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Well, this works, so it's something else in that calling script: https://github.com/iinnovations/iicontrollibs/blob/master/cupid/mytest.py On 3/28/2014 09:00, Michael Markstaller wrote: Which busmaster(s) and owfs-Version are you using? Michael

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
2.9p1 and DS2483 It has been absolutely bulletproof up until now. Still is if I run the script as a standalone. On 3/28/2014 09:00, Michael Markstaller wrote: Which busmaster(s) and owfs-Version are you using? Michael

[Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Hell all, I've run into an interesting error that results in sensors disappearing altogether, resulting in the error: File /usr/lib/python2.7/dist-packages/ow/__init__.py, line 271, in __init__ self.useCache( self._useCache ) File /usr/lib/python2.7/dist-packages/ow/__init__.py, line

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Stefano Miccoli
Is there a reason for using ow (which is a SWIG binding of the owlib C API) and not ownet (which is a pure python implementation of the ownet protocol)? If you do not have to access the bus master directly from python but you have an owserver running, I would suggest using instead ownet, or

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
I use owpython to connect to owserver: ow.init('localhost:4304') The reason (at the moment) is that owpython does everything I need to do and I've built code around it. On 3/28/2014 10:57, Stefano Miccoli wrote: Is there a reason for using ow (which is a SWIG binding of the owlib C API) and

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Michael Markstaller
Which busmaster(s) and owfs-Version are you using? Michael -- ___ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Ok, this is truly bizarre. I narrowed it down to the inclusion of a statement that does will cause ow.init to fail as described, even when the code is not run. The offensive statements were the creation of strings for sqlite queries, such as : querylist.append('insert into inputs values(\'' +

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Stefano, For me, this is all I need to list all my sensors, and have a similar routine to read values: import ow import pilib querylist = [] ow.init('localhost:4304') sensorlist = ow.Sensor('/').sensorList() for sensor in sensorlist: querylist.append(

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Ok, after becoming thoroughly annoyed with owpython, I wrote around pyownet. See the first three functions/classes. I did not install pyownet, but located it in a subdirectory. I will add sufficient attribution when I get a minute. Let me know what you think.

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
And I've now successfully duplicated the error in pyownet: File /usr/lib/iicontrollibs/cupid/owfslib.py, line 27, in owbuslist for dir in OwnetProxy(host).dir(): File /usr/lib/iicontrollibs/resource/pyownet/protocol.py, line 408, in dir raise OwnetError(-ret, self.errmess[-ret],

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Stefano Miccoli
Yes you are right: while there is some experimental code that implements the idea of a sensor with attributes corresponding to values https://github.com/miccoli/pyownet/tree/sensors this is still very experimental. Nevertheless the low level approach is not so much different: from

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Stefano Miccoli
I would avoid calls like OwnetProxy(host).read(prop).strip() you should reuse the proxy object between calls: __init__(self, ) self.proxy = OwnetProxy(host) def method(self, ...) self.proxy.read(prop).strip() There is a cost in creating the proxy object, but no significant

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
Got it. Fixed within functions/methods. I'll look at passing the reference around later. On 3/28/2014 14:42, Stefano Miccoli wrote: I would avoid calls like OwnetProxy(host).read(prop).strip() you should reuse the proxy object between calls: __init__(self, ) self.proxy =

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Stefano Miccoli
This error is entirely on the owserver side... owpython and the friends seem not to be responsible. pyownet.protocol.OwnetError exceptions are raised when the remote owserver answers with an error code, in this case -5, that according to owserver --help=error is 5. legacy - IO error you

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
I've no idea where to even start on this. On 3/28/2014 14:49, Stefano Miccoli wrote: This error is entirely on the owserver side... owpython and the friends seem not to be responsible. pyownet.protocol.OwnetError exceptions are raised when the remote owserver answers with an error code,

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Stefano Miccoli
Try running owserver --debug and watch for error messages. S. On 28 Mar 2014, at 23:33, Colin Reese colin.re...@gmail.com wrote: I've no idea where to even start on this. On 3/28/2014 14:49, Stefano Miccoli wrote: This error is entirely on the owserver side... owpython and the friends

Re: [Owfs-developers] ow Python makes sensors disappear

2014-03-28 Thread Colin Reese
and ... drum roll ... the answer was to remove all double quotes from sqlite query preparation statements in the calling script, escaping included single quotes. I don't understand it, but it fixed it. Colin On 3/28/2014 15:55, Stefano Miccoli wrote: Try running owserver --debug and