[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] python exception

From: Johnathan Corgan
Subject: Re: [Discuss-gnuradio] python exception
Date: Fri, 31 Aug 2007 07:06:36 -0700
User-agent: Thunderbird (X11/20070824)

Dominik Auras wrote:

> Exception exceptions.ReferenceError: 'weakly-referenced object no longer
> exists' in <bound method db_flexrf_2400_tx_mimo_b.__del__ of
> <gnuradio.db_flexrf_mimo.db_flexrf_2400_tx_mimo_b object at 0x8895c2c>>
> ignored

The subdev object internally holds a weak reference to the USRP object
(this avoids a circular dependency.)

When your class goes out of scope at the end of your application, Python
deletes all of the class members and then the class itself.  In this
case, what is happening is that Python deletes the USRP object, and then
when it deletes the subdev, the weak reference points to nothing, hence
the error.

While it's harmless, to avoid the error message, I put in an explicit
call to delete the subdev object inside the __del__ method of the
enclosing class.  That way, the subdev object is forced to be deleted
before Python deletes the USRP object:

class foo:
        def __del__(self):
                del self.subdev

(adjust for your class and member names)

Johnathan Corgan
Corgan Enterprises LLC

reply via email to

[Prev in Thread] Current Thread [Next in Thread]