After consulting with the python guru's on freenode, it turns out that
the problem comes from line 256 in the file:

        self._attrs = { }
I don't understand python enough to know why, but they said this is a
recursive call.  I don't have a clue as to how to fix it.

--Jim

On Wed, Jul 21, 2010 at 10:48 AM, Jim Kusznir <jkusz...@gmail.com> wrote:
> I think I found the function that's going recursive, but I don't know
> why its going recursive.  In the module, near line 345, there is:
>
> def __getattr__( self, name ):
>        """
>        Retreive an attribute from the sensor. __getattr__ is called
>        only if the named item doesn't exist in the Sensor's
>        namespace. If it's not in the namespace, look for the attribute
>        on the physical sensor.
>
>        Usage:
>
>            s = ow.Sensor( '/1F.5D0B01000000' )
>            print s.family, s.PIO_0
>
>        will result in the family and PIO.0 values being read from the
>        sensor and printed. In this example, the family would be 1F
>        and thr PIO.0 might be 1.
>        """
>        print 'Sensor.__getattr__', name
>        if name in self._attrs:
>            attr = owfs_get( self._attrs[ name ] )
>        else:
>            raise AttributeError, name
>
>        return attr
>
>
> (the print statement was there, but commented.  I uncommented it for
> debugging).  This is in the sensor class.  This function is definitely
> being called recursively.
>
> --Jim
>
> On Wed, Jul 21, 2010 at 9:47 AM, Jim Kusznir <jkusz...@gmail.com> wrote:
>> Well, I'm stuck in a predicament where I have to get this code working
>> by this thurs at 1pm, and my python dev insists the bug is inside
>> owfs, and therefore is not doing anything else.  I'm not proficient in
>> python yet myself, so I'm having difficulty proving/disproving
>> anything in this case.  So, I'm looking for any help/suggestions.
>>
>> I did some googling, and found this samle code online (owfs sf faq site):
>>
>> 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 )
>>
>> if __name__ == "__main__":
>>    if len( sys.argv ) == 1:
>>        print 'usage: tree.py u|serial_port_path'
>>        sys.exit( 1 )
>>    else:
>>        ow.init( sys.argv[ 1 ] )
>>        tree( ow.Sensor( '/' ) )
>>
>> This program (from http://owfs.sourceforge.net/faq.html ) should
>> simply list all the devices in the tree.  Instead, what I get is this:
>>
>> casasdbu...@debug /usr/local/CASAS $ python2.6 ~/ow-test.py u
>>  DS9490 - /
>> Exception RuntimeError: 'maximum recursion depth exceeded in
>> __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
>>  DS2406 - /12.748046000000
>> Exception RuntimeError: 'maximum recursion depth exceeded in
>> __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
>>  DS2406 - /12.DD365F000000
>> Exception RuntimeError: 'maximum recursion depth exceeded in
>> __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
>>  DS1420 - /81.05412A000000
>>
>> The above devices are accurate; I have two DS2406 devices hooked into
>> a USB 2490 master.  However, the maximum recursion depth is a major
>> problem, and causes our code to blow up.
>>
>> I'd greatly appreciate any help in fixing this.  I'm also curious to
>> hear from others that are using owpython, especially with python2.6.
>>
>> Thanks!
>> --Jim
>>
>> On Tue, Jul 20, 2010 at 2:08 PM, Jim Kusznir <jkusz...@gmail.com> wrote:
>>> Hi all:
>>>
>>> Our lab has been fighting against a problem recently with owfs and python 
>>> 2.6.
>>>
>>> We had been happily using python 2.5 and owfs p22 for quite some time.
>>>  Its been nice and stable, and life was good.  Unfortunately, we had a
>>> new piece of code that required us to upgrade our python system.  Ever
>>> since upgrading to 2.6, our attempts at running our software blow up.
>>> Our software engineer on the project traced the blow-up to when he
>>> called an owfs function.  The blow-up is a recursion depth problem,a
>>> nd in the process, it only sees one OW device on our network now.
>>>
>>> So, first thing we did: upgraded to the latest version of owfs (p39),
>>> and retry.  Unfortunately, the behavior is the same.  We're at a loss,
>>> as we have stripped out as much of our code as possible.
>>>
>>> I'm currently trying to get a dev machine going on python2.5 again to
>>> try and concretely nail down the problem, but for the moment, this is
>>> what I have.  Any suggestions?
>>>
>>> Here's sample output:
>>>
>>> casasdbu...@debug /usr/local/CASAS $ ./casas_OneWireAgent.py
>>> authenticated
>>> raw = 
>>> 12.748046000000/,12.DD365F000000/,81.05412A000000/,bus.0/,settings/,system/,statistics/,structure/
>>> ['12.748046000000/', '12.DD365F000000/', '81.05412A000000/', 'bus.0/',
>>> 'settings/', 'system/', 'statisti
>>> see: 12.748046000000/
>>> addSensor( 12.748046000000/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> ERROR: Sensor Initialization [12.748046000000/]
>>> see: 12.DD365F000000/
>>> addSensor( 12.DD365F000000/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> ERROR: Sensor Initialization [12.DD365F000000/]
>>> see: 81.05412A000000/
>>> addSensor( 81.05412A000000/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> see: bus.0/
>>> addSensor( bus.0/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(bus.0/)
>>> see: settings/
>>> addSensor( settings/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(settings/)
>>> see: system/
>>> addSensor( system/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(system/)
>>> see: statistics/
>>> addSensor( statistics/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(statistics/)
>>> see: structure/
>>> addSensor( structure/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(structure/)
>>> see: alarm/
>>> addSensor( alarm/ )
>>> Exception RuntimeError: 'maximum recursion depth exceeded in
>>> __subclasscheck__' in <type 'exceptions.Att
>>> Error in addSensor(alarm/)
>>> OneWire Network Initialized
>>> Exception RuntimeError: 'maximum recursion depth exceeded while
>>> calling a Python object' in <type 'excep
>>> Exception RuntimeError: 'maximum recursion depth exceeded while
>>> calling a Python object' in <type 'excep
>>> Exception RuntimeError: 'maximum recursion depth exceeded while
>>> calling a Python object' in <type 'excep
>>> ^Ccleaning up
>>> Traceback (most recent call last):
>>>  File "./casas_OneWireAgent.py", line 375, in <module>
>>>    mycon.finish()
>>>  File "./casas_OneWireAgent.py", line 274, in finish
>>>    self.xmpp.disconnect()
>>>  File "/usr/local/CASAS/casas/xmpp.py", line 122, in disconnect
>>>    self.reactor.stop()
>>>  File "/usr/lib/python2.6/site-packages/twisted/internet/base.py",
>>> line 553, in stop
>>>    "Can't stop reactor that isn't running.")
>>> twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't 
>>> running.
>>> -------------
>>> Failure occurred at new = ow.Sensor(newsensor);
>>>
>>> class Sensors:
>>>    def __init__(self):
>>>        self.data = dict()
>>>        self.valid = ["DS2406","DS18B20","DS2450"]
>>>        self.publish = None
>>>        return
>>>
>>>    def addSensor(self, sensor):
>>>        print "addSensor( %s )" % sensor
>>>        newsensor = "/%s" % sensor[:-1]
>>>        try:
>>>            new = ow.Sensor(newsensor)
>>>        except:
>>>            print "Error in addSensor(%s)" % sensor
>>>            return
>>> <snip>
>>>
>>> Any suggestions on this?
>>>
>>> Thanks!
>>> --Jim
>>>
>>
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to