Chris <chrism <at> cjsoftuk.dyndns.org> writes: > > > I'm trying to use owpython, but when I run the tree.py sample, I get: > > ow.exUnknownSensor: '/system/adapter/name.0' > > and an exception traceback. > > What is happening? > > Traceback (most recent call last): > File "tree.py", line 47, in ? > tree( ow.Sensor( '/' ) ) > File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 258, in > __init__ > > File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 401, in > useCache > > File "/usr/lib/python2.4/site-packages/PIL/__init__.py", line 146, in _get > > Chris
Chris, I found the same problem when trying to connect to an owserver by specifying hostname:port. I have done two things to fix the problem. 1. Don't use the "ow" package, but use "ownet" ownet.init('localhost:4304') tree(ownet.Sensor('/')) 2. Fixed the ownet package to properly use the _server and _port passed to init and to properly cast the port to an integer. It seems this must be untested code. An alternate would be to not use ownet's init and use something akin to: tree(ownet.Sensor('/', 'localhost', 4304 ) specifying the host and port directly to the constructor. I'm not a python god by any means, but here is my fixed ownet.Sensor code in ownet/__init.py__ replace _port = pair[1] with _port = int(pair[1]) Then in class Sensor function __init__ replace # setup the connection to use for connunication with the owsensor server if connection: self._connection = connection elif not server or not port: global _server global _port if not _server or not _port: raise exNotInitialized else: self._connection = Connection(server, port) else: self._connection = Connection(server, port) with (note only one line changes -- the first call to Connection) # setup the connection to use for connunication with the owsensor server if connection: self._connection = connection elif not server or not port: global _server global _port if not _server or not _port: raise exNotInitialized else: self._connection = Connection(_server, _port) else: self._connection = Connection(server, port) Working for me, so far. I've not poked about here enough to know who to send these as diffs to to fix the source in CVS. They are (in my opinion) wrong in the current CVS version. And there is something really annoying here complaining about longer than 80 char lines that is not helping my desire to even post this message. Can it be more discouraging? Stephen ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Owfs-developers mailing list Owfs-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/owfs-developers