473,753 Members | 7,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.__ini t__(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 1040

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

Similar topics

6
4272
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. The problem is that I have to explicitly code the source files location within the source which is not very portable. Is there anyway for a python module to locate its own source ? Thanks
36
8400
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, but a prime number tester would also be nice. I'm dealing with numbers in the 10^6-10^8 range so it would have to fairly efficient Dag
4
8442
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 extended periods during a while loop
18
3051
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 a single collections type, I should be proposing a new "namespaces" module instead. Some of my reasons: (1) Namespace is feeling less and less like a collection to me. Even though it's still intended as a data-only structure, the use cases...
4
13904
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
901
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 module is _not_ compatible with cmd.py, as it is command oriented, whereas cmd.py is line oriented. Anyway, I'm looking for feedback, feature requests before starting the submission process.
1
17254
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 code example from http://www.python.org/doc/2.4.2/ext/run-func.txt I call the file "TestOfficiel.c" and I compile it with : gcc -g -I/usr/include/python2.3/ TestOfficiel.c -o TestOfficiel -lpython2.3 -ldl all is OK (or seems to be...).
21
34433
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 obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
1
3973
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 Files\Python25\Scripts\f2py.py" -c fib1.f running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --
0
9072
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8896
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9451
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9421
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8328
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6869
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.