Hi Joshua,

Am Donnerstag, den 16.09.2010, 22:05 -0800 schrieb Joshua J. Kugler:
> One of them was with ctypes, which didn't want to find my libowcapi.so 
> in /usr/local/lib (even though ldconfig -p confirmed it was known).

there is a new version which fixes this - are you sure you are using the
latest ?!?!

> The other was with sensor types.
> 
> Running a tree example from owfs, which basically is:
> 
> def tree( sensor ):
>     print '%7s - %s' % ( sensor._type, sensor._path )
>     for next in sensor.sensors( ):
>         if next._type in [ 'DS2409', ]:
>             tree( next )
>         else:
>             print '%7s - %s' % ( next._type, next._path )
> 
> I got this:
> 
>  HA7Net - /
> DS18S20 - /10.20C9F9010800
> DS18S20 - /10.7DC8DF010800
>  DS2417 - /27.F5440A000000
> 
> That's <type> - <id>
> 
> With your example of
> 
> for s in root.find():
>     print s
> 
> I get:
> 
> <Sensor /10.20C9F9010800/ - None>
> <Sensor /10.7DC8DF010800/ - None>
> <Sensor /27.F5440A000000/ - DS2417>
>
> I had to modify __repr__ to:
> 
>     def __repr__ (self) :
>         try:
>             stype = self.get("type")
>         except KeyError:
>             stype = 'None'
>         return "<Sensor %s - %s>" % (self.path, stype)
> 
> Because self.get('type') was raising a key error.
> 
> Any idea why it fails for pyowfs but not for ow?

hmmm, thats interesting - KeyError would mean that there is no such
entry "type" for this sensor in the owfs tree - you can check this with
e.g. owhttpd .... or list all entries which are available using:

for e in s.iter_entries () : 
    print e

thats basically what "get" also does ... 

if your wanted entry isnt there it raises a KeyError - which is correct
python behaviour ... what i could do is propably add a "default" value
you get back when the wanted key does not exist ... like in pythons
dict().get() behaviour ... 

> I might look into using pyowfs...I'm still evaluating my options.

yeah, thats fine !!! i just got a nice walkthrough through
fairbanks ... ;) - yeah its really far away from me - im in Riedenthal,
Austria - if you would like to check - but i doubt that street map cars
have been here already ;) - google maps is really nice ;)

> Thanks!

you're welcome ;)

> BTW, is there a mailing list for pyowfs?

not for now - but if its ok for paul i think we can use the owfs-dev
list as long as traffic stays at this level ... therefore i will forward
this post also to owfs-developers ...

regards,
marcus.



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to