473,230 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

PyPubSub module version 3 usage

Hello,

I just recently found out that wx.lib.pubsub has finally moved away from wx,
and now lives at:

http://pubsub.wiki.sourceforge.net

I'm trying to use pubsub3, which is the third version and now the default one,
but I'm having a hard time creating topics and messages for sending:
class Topic:
__init__(self, _name, _description, _parent=None, **kwargs)
| Specify the name, description, and parent of
| this Topic, and the list of kwargs allowed on listeners
| of this topic. The non-kwargs all start with a '_' to
| minimize the chance of conflict with a kwargs key.

from pubsub import pub
class Test(pub.Topic):
def __init__(self):
pub.Topic.__init__(self, 'Topic.Test', 'This is a test topic')

class Msg(pub.Message):
pass

pub.sendMessage(Test())

Traceback (most recent call last):
File "topics.py", line 80, in <module>
pub.sendMessage(Test())
File "build/bdist.linux-i686/egg/pubsub/pubsub3.py", line 421, in
sendMessage
File "build/bdist.linux-i686/egg/pubsub/pubsub3.py", line 195, in
sendMessage
File "/home/frank/test/topics.py", line 155, in getTopic
File "/home/frank/test/topics.py", line 162, in __getTopic

TypeError: iteration over non-sequence.

pub.sendMessage(Msg())

Traceback (most recent call last):
File "topics.py", line 80, in <module>
pub.sendMessage(Test())
File "build/bdist.linux-i686/egg/pubsub/pubsub3.py", line 421, in
sendMessage
File "build/bdist.linux-i686/egg/pubsub/pubsub3.py", line 195, in
sendMessage
File "/home/frank/test/topics.py", line 155, in getTopic
File "/home/frank/test/topics.py", line 162, in __getTopic

TypeError: iteration over non-sequence.
The variable in question for class Test() contains:

Topic 'T.o.p.i.c...T.e.s.t': This is a test topic. Listeners that have
'topic=pub.AUTO_PASS_TOPIC' as a kwarg will get the topic name as
value of topic (ie 'T.o.p.i.c...T.e.s.t'). Listeners must
otherwise be callable with no args.
No listeners are currently subscribed.
There are currently no subtopics.

which of course is non-iterable. Same for class Msg(), So obviously my Topic
and Message class constructors are wrong. The code on the wiki is for
pubsub2, and seems to be outdated compared to pubsub3 API. pubsub1 is the
same as wx.lib.pubsub btw.

Basically I'm looking for example code to get me kickstarted using pubsub3.

Best regards,
Frank
Nov 29 '07 #1
0 1021

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: sj | last post by:
I have written several small shell utilities in Python and typically use comments at the start of the source file as documentation. A command line option allows the user to read this documentation....
36
by: Dag | last post by:
Is there a python module that includes functions for working with prime numbers? I mainly need A function that returns the Nth prime number and that returns how many prime numbers are less than N,...
4
by: Brad Tilley | last post by:
When memory usage is a concern, is it better to do: from X import Y or import X Also, is there a way to load and unload modules as they are needed. I have some scripts that sleep for...
18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
4
by: Brad Parks | last post by:
Are there any performance or memory-usage benefits of placing public functions and subroutines in a Class Module rather than a standard module?
0
by: Crutcher | last post by:
This is something I've been working on for a bit, and I think it is more or less ready to bring up on this list. I'd like to add a module (though probably not for 2.5). Before you ask, this...
1
by: alain MONTMORY | last post by:
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem..... :-http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding I download the...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
by: bkamrani | last post by:
Hi Python gurus, I have installed numpy and interested in testing f2py module using the first example in the documentation. First I tried: C:\test>python "C:\Program...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.