473,327 Members | 2,074 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,327 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 1024

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: 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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.