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 417, in
useCache
for n in owfs_get( self._usePath ).split( ',' ) ] )
File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 159, in _get
raise exUnknownSensor(path)
ow.exUnknownSensor: '/'
Sure enough, my 1Wire directory is empty except the bus. Killing owfs,
owserver and owhttpd and attempting to restart using the same commands I
do at startup yields:
DEFAULT: owlib.c:(56) No valid 1-wire buses found
After rebooting, everything is fine again, until I run the questionable
script. So the first question is how to reinitialize after fail without
rebooting. The next is how to not have it fail in the first place. I see
mention here, but no solution:
http://owfs-developers.1086194.n5.nabble.com/Bug-in-re-init-ing-Python-ow-module-td4442.html
What I'm using in owpython is pretty basic, and trimming out other code
is really:
import ow
ow.init('localhost:4304')
for sensor in ow.Sensor('/').sensorList():
# do stuff
Interestingly, if I have this in a function like:
def myowfsfun(args):
ow.init('localhost:4304')
for sensor in ow.Sensor('/').sensorList():
#do stuff
if __name__ == "__main__":
myowfsfun(args)
I can run the function via the script file until the cows come home. If
I import it into another script, e.g.:
import owfslib
owfslib.myowfsfun(args)
and then run that script, it barfs immediately.
Ideas?
Thanks,
Colin
------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers