As already pointed out by Jan, 

the
> pyownet.protocol.ConnError: [Errno 111] Connection refused

exception (see 
http://pyownet.readthedocs.io/en/latest/protocol.html#pyownet.protocol.ConnError
 
<http://pyownet.readthedocs.io/en/latest/protocol.html#pyownet.protocol.ConnError>
 ) simply wraps the underlying OS error code, which in this case was 111 or 
ECONNREFUSED. Typically this means that nobody is listening on the host/port 
you specified within the proxy() function and this is a symptom of a dead 
owserver process.

For debugging this situation you can issue

$ netstat -tl

and confirm that there is no active process listening on localhost:4304 (or 
*:4304). (You can also ‘sudo netstat -tlp’ if you are looking for specific info 
on which process is listening on which port.)

As what regards starting/restarting the owserver process, unfortunately Debian 
has adopted systemd as its init system, although a lot of systemV inits scripts 
are still around. You should therefore use the systemd command

$ sudo systemctl restart  owserver.service

instead of the systemV command ‘service’ which works only for systemV init.d 
scripts. 

Debugging init systems is black magic, but here is a list (in random order) of 
commands that I use. (prepend sudo if you are not root)

$ systemctl stop owserver.service; systemctl start owserver.service # which 
sometimes is different from a plain systemctl restart
$ systemctl status owserver.service
$ killall owserver # sometimes the init scripts fails to stop running services
$ killall -KILL owserver
$ netstat -tlp
$ journalctl -e

and so on.

S.


> On 03 Aug 2016, at 23:43, Mick Sulley <m...@sulley.info> wrote:
> 
> Setfano, or anyone else who can help.
> 
> I installed pyownet and got it working and I have been developing my 
> code for several days, but this evening it has stopped working.  I have 
> gone back to your basic instructions and this is what I see -
> 
> control@pi-test:~ $ python
> Python 2.7.9 (default, Mar  8 2015, 00:52:26)
> [GCC 4.9.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from pyownet.protocol import proxy
>>>> owp = proxy(host='localhost')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/dist-packages/pyownet/protocol.py", 
> line 729, in proxy
>     raise ConnError(*lasterr)
> pyownet.protocol.ConnError: [Errno 111] Connection refused
>>>> 
> 
> 
> It happened after I restarted the server with
> 
> sudo service owserver restart
> 
> I have rebooted since but it is still the same.  Any idea what the 
> problem may be?
> 
> Thanks
> Mick
> 
> 
> 
> On 28/07/16 10:50, Stefano Miccoli wrote:
>> Shameless self-promotion: you should use pyownet, which is documented at 
>> http://pyownet.readthedocs.io/en/latest/
>> 
>> If you already have an owserver running on your localhost you can start with
>> 
>> $ pip install pyownet
>> $ python
>>>>> from pyownet.protocol import proxy
>>>>> owp = proxy(host='localhost')
>>>>> owp.dir()
>> ['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', 
>> '/01.000001FE0300/', '/43.000043BC0400/']
>>>>> float(owp.read('/26.000026D90200/temperature'))
>> 4.0
>> 
>> The idea is to have a proxy object, whose methods correspond to the ownet 
>> operations (dir, read, write, ping, present, etc.) Calls to the proxy 
>> methods are lightweight, while creation of the proxy object is a little more 
>> costly, so please resiste to the temptation of calling
>> 
>> pyownet.protocol.proxy().dir()
>> 
>> but always create  a proxy object at program initialisation and reuse it 
>> throughout your script.
>> 
>> Stefano
>> 
>>> On 27 Jul 2016, at 21:26, Mick Sulley <m...@sulley.info> wrote:
>>> 
>>> Looking at converting my current Python code from owfs to ow-shell.  I
>>> have found a few different Python bindings, any opinions on which one to
>>> use?  Also there does not seem to be much documentation on any of them,
>>> can anyone point me in the right direction?
>>> 
>>> Thanks
>>> 
>>> Mick
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Owfs-developers mailing list
>>> Owfs-developers@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>> 
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Owfs-developers mailing list
>> Owfs-developers@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to