wxPython and pubsub error

I am using pubsub module which is working fine. How ever when I am closing my frame I am getting an error:

Traceback (most recent call last):
File “C:\Python25\Lib\site-packages\pubsubcore\weakmethod.py”, line 42, in __onNotifyDeadObj
self.notifyDead(self)
File “C:\Python25\Lib\site-packages\pubsubcore\listener.py”, line 128, in __notifyOnDead
notifyDeath(self)
File “C:\Python25\Lib\site-packages\pubsubcore\topics.py”, line 989, in __onDeadListener
sgl.topicMgr.onDeadListener(self, listener)
AttributeError: ‘NoneType’ object has no attribute ‘topicMgr’

could anybody point me out the reason?

Prashant

···

Be the first one to try the new Messenger 9 Beta! Click here.

I believe you have a listener registered that no longer exists, and
pubsub is trying to dispatch a Message to that listener.

···

On Wed, Oct 1, 2008 at 12:01 PM, Prashant Saxena <animator333@yahoo.com> wrote:

I am using pubsub module which is working fine. How ever when I am closing
my frame I am getting an error:

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\pubsubcore\weakmethod.py", line 42, in
__onNotifyDeadObj
    self.notifyDead(self)
  File "C:\Python25\Lib\site-packages\pubsubcore\listener.py", line 128, in
__notifyOnDead
    notifyDeath(self)
  File "C:\Python25\Lib\site-packages\pubsubcore\topics.py", line 989, in
__onDeadListener
    sgl.topicMgr._onDeadListener_(self, listener)
AttributeError: 'NoneType' object has no attribute 'topicMgr'

could anybody point me out the reason?

Prashant

________________________________
Be the first one to try the new Messenger 9 Beta! Click here.
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
Stand Fast,
tjg. [Timothy Grant]

I’m not sure why it would do that. “sgl” is a module (pubsubcore/singletons.py) containing a TopicManager instance, topicMgr, which manages pubsub topic creation/destruction. The method called (__onDeadListener) is called when a listener (subscribed to a topic) is garbage collected, so it can be automatically unsubscribed from the topic. It is strange that Python interpreter says sgl is None since it is never set to that, but since it is at application exit it is possible it has to do with garbage collection of the whole package.

Here are some things you could try:

  1. Put print self.getName(), str(listener) just before sgl.topicMgr to print out the topic name and listener id; this might give you enough info to just unsubscribe the one or two listeners that cause problem
  2. Explicitly unsubscribe all your listener(s) before exiting, until get ride of the error; this is less than ideal
  3. The singleton stuff has recently been changed to use data members so in the most recent version (not yet committed), the problem may no longer exist; if you want I could send you an egg of it so you can try it out.
  4. Give me something to reproduce the error, but given that most recent version is different it is probably worth doing #3 first;
  5. Other ideas? I’m open to suggestions.

Oliver

···

On Wed, Oct 1, 2008 at 3:01 PM, Prashant Saxena animator333@yahoo.com wrote:

I am using pubsub module which is working fine. How ever when I am closing my frame I am getting an error:

Traceback (most recent call last):
File “C:\Python25\Lib\site-packages\pubsubcore\weakmethod.py”, line 42, in __onNotifyDeadObj
self.notifyDead(self)
File “C:\Python25\Lib\site-packages\pubsubcore\listener.py”, line 128, in __notifyOnDead

notifyDeath(self)

File “C:\Python25\Lib\site-packages\pubsubcore\topics.py”, line 989, in __onDeadListener
sgl.topicMgr.onDeadListener(self, listener)
AttributeError: ‘NoneType’ object has no attribute ‘topicMgr’

could anybody point me out the reason?

Prashant


Be the first one to try the new Messenger 9 Beta! Click here.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hadn’t seen this reply. Part about listener no longer existing is true, part about dispatch to that listener is not :slight_smile: See my other reply in same thread.
Oliver

···

On Wed, Oct 1, 2008 at 3:22 PM, Timothy Grant timothy.grant@gmail.com wrote:

On Wed, Oct 1, 2008 at 12:01 PM, Prashant Saxena animator333@yahoo.com wrote:

I am using pubsub module which is working fine. How ever when I am closing

my frame I am getting an error:

Traceback (most recent call last):

File “C:\Python25\Lib\site-packages\pubsubcore\weakmethod.py”, line 42, in

__onNotifyDeadObj

self.notifyDead(self)

File “C:\Python25\Lib\site-packages\pubsubcore\listener.py”, line 128, in

__notifyOnDead

notifyDeath(self)

File “C:\Python25\Lib\site-packages\pubsubcore\topics.py”, line 989, in

__onDeadListener

sgl.topicMgr._onDeadListener_(self, listener)

AttributeError: ‘NoneType’ object has no attribute ‘topicMgr’

could anybody point me out the reason?

Prashant


Be the first one to try the new Messenger 9 Beta! Click here.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I believe you have a listener registered that no longer exists, and

pubsub is trying to dispatch a Message to that listener.

Stand Fast,

tjg. [Timothy Grant]


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

oliver wrote:

I'm not sure why it would do that. "sgl" is a module (pubsubcore/singletons.py) containing a TopicManager instance, topicMgr, which manages pubsub topic creation/destruction. The method called (__onDeadListener) is called when a listener (subscribed to a topic) is garbage collected, so it can be automatically unsubscribed from the topic. It is strange that Python interpreter says sgl is None since it is never set to that, but since it is at application exit it is possible it has to do with garbage collection of the whole package.

Part of the process of shutting down the interpreter is to try and force the collection of things that even the normal garbage collection would not do. IIRC after a few passes through the remaining objects it will actually set remaining values in modules to None to try and break cycles. I think this is explained in the Python docs somewhere.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for that clarification Oliver!

···

On Wed, Oct 1, 2008 at 1:59 PM, oliver <oliver.schoenborn@gmail.com> wrote:

Hadn't seen this reply. Part about listener no longer existing is true, part
about dispatch to that listener is not :slight_smile: See my other reply in same
thread.
Oliver

On Wed, Oct 1, 2008 at 3:22 PM, Timothy Grant <timothy.grant@gmail.com> > wrote:

On Wed, Oct 1, 2008 at 12:01 PM, Prashant Saxena <animator333@yahoo.com> >> wrote:
> I am using pubsub module which is working fine. How ever when I am
> closing
> my frame I am getting an error:
>
> Traceback (most recent call last):
> File "C:\Python25\Lib\site-packages\pubsubcore\weakmethod.py", line
> 42, in
> __onNotifyDeadObj
> self.notifyDead(self)
> File "C:\Python25\Lib\site-packages\pubsubcore\listener.py", line 128,
> in
> __notifyOnDead
> notifyDeath(self)
> File "C:\Python25\Lib\site-packages\pubsubcore\topics.py", line 989,
> in
> __onDeadListener
> sgl.topicMgr._onDeadListener_(self, listener)
> AttributeError: 'NoneType' object has no attribute 'topicMgr'
>
> could anybody point me out the reason?
>
> Prashant
>
> ________________________________
> Be the first one to try the new Messenger 9 Beta! Click here.
> _______________________________________________
> wxpython-users mailing list
> wxpython-users@lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>
>

I believe you have a listener registered that no longer exists, and
pubsub is trying to dispatch a Message to that listener.

--
Stand Fast,
tjg. [Timothy Grant]
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

--
Stand Fast,
tjg. [Timothy Grant]