pubsub AUTO_TOPIC import fails in 2.9.3.1

I've been using Oliver's latest version (3.1.1b1) of pubsub for a while now. In that version this import works:

   from pubsub.pub import AUTO_TOPIC

Attempting to use the version in 2.9.3.1 this import fails:

   from wx.lib.pubsub.pub import AUTO_TOPIC

Any suggestions for getting this working?

Thanks,
Michael Hipp

I’ve been using Oliver’s latest version (3.1.1b1) of pubsub for a while now. In that version this import works:

from pubsub.pub import AUTO_TOPIC

Attempting to use the version in 2.9.3.1 this import fails:

from wx.lib.pubsub.pub import AUTO_TOPIC

Any suggestions for getting this working?

Michael,

The pubsub in wx still defaults to old (and I wish, deprecated) API, where AUTO_TOPIC is not available. To make use of the new pubsub API in wx.lib.pubsub, you must first import the setupkwargs:

from wx.lib.pubsub import setupkwargs

from wx.lib.pubsub.pub import AUTO_TOPIC

This is the default in stock pubsub, of course, so the first import is not necessary:

from pubsub.pub import AUTO_TOPIC

just works.

Oliver

···

On Wed, Jan 4, 2012 at 5:39 PM, Michael Hipp michael@redmule.com wrote:

Also note that the pubsub version in wx is the latest, pubsub 3.1.2 on sourceforge.net (but not the latest SVN).

Oliver

···

On Wed, Jan 4, 2012 at 5:39 PM, Michael Hipp michael@redmule.com wrote:

I’ve been using Oliver’s latest version (3.1.1b1) of pubsub for a while now. …

Thanks, Oliver. It works.

Michael

···

On 2012-01-05 7:01 AM, oliver wrote:

    from wx.lib.pubsub import setupkwargs
    from wx.lib.pubsub.pub import AUTO_TOPIC

Oliver,

If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.

···

On 1/5/12 5:01 AM, oliver wrote:

The pubsub in wx still defaults to old (and I wish, deprecated) API,
where AUTO_TOPIC is not available. To make use of the new pubsub API in
wx.lib.pubsub, you must first import the setupkwargs:

    from wx.lib.pubsub import setupkwargs
    from wx.lib.pubsub.pub import AUTO_TOPIC

--
Robin Dunn
Software Craftsman

Sounds good, I will do that. Where should I put instructions for users who will be upgrading an app from wx 2.8 to 2.9, as they will have to add one line to use previous API.

Oliver

···

On Thu, Jan 5, 2012 at 1:32 PM, Robin Dunn robin@alldunn.com wrote:

On 1/5/12 5:01 AM, oliver wrote:

The pubsub in wx still defaults to old (and I wish, deprecated) API,

where AUTO_TOPIC is not available. To make use of the new pubsub API in

wx.lib.pubsub, you must first import the setupkwargs:

from wx.lib.pubsub import setupkwargs

from wx.lib.pubsub.pub import AUTO_TOPIC

Oliver,

If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.

I would think your wxPython wiki page would be one good place for it: http://wiki.wxpython.org/WxLibPubSub

If Robin puts out a migration guide, that would be a good place too.

···

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Put it in at least the package's docstring, and you can also give me a few sentences to put into the CHANGES document.

···

On 1/6/12 5:20 AM, oliver wrote:

On Thu, Jan 5, 2012 at 1:32 PM, Robin Dunn <robin@alldunn.com > <mailto:robin@alldunn.com>> wrote:

    On 1/5/12 5:01 AM, oliver wrote:

        The pubsub in wx still defaults to old (and I wish, deprecated) API,
        where AUTO_TOPIC is not available. To make use of the new pubsub
        API in
        wx.lib.pubsub, you must first import the setupkwargs:

            from wx.lib.pubsub import setupkwargs
            from wx.lib.pubsub.pub import AUTO_TOPIC

    Oliver,

    If you would like to add a version check and default to the new API
    if running in wx 2.9 then I would be open to that change. The 2.9
    release series is a good time to introduce a change for the better
    default behavior.

Sounds good, I will do that. Where should I put instructions for users
who will be upgrading an app from wx 2.8 to 2.9, as they will have to
add one line to use previous API.

--
Robin Dunn
Software Craftsman

I have added (to SVN) some code in autosetuppubsubv1.py which only activates v1 API if wx < 2.9. However, doing this portably and such that it doesn’t break the standalone pubsub was tricky. Tested on Windows XP with py 2.6 and wx 2.8, and tested also by changing the wx major and minor release # in version.py file to test 2.9 and 3.7; correctly selected latest pubsub API.

Did not test on Linux but I used fnmatch which should take care of any os-dependent path separator issues. Let me know what you think.

Oliver

···

On Thu, Jan 5, 2012 at 1:32 PM, Robin Dunn robin@alldunn.com wrote:

On 1/5/12 5:01 AM, oliver wrote:

The pubsub in wx still defaults to old (and I wish, deprecated) API,

where AUTO_TOPIC is not available. To make use of the new pubsub API in

wx.lib.pubsub, you must first import the setupkwargs:

from wx.lib.pubsub import setupkwargs

from wx.lib.pubsub.pub import AUTO_TOPIC

Oliver,

If you would like to add a version check and default to the new API if running in wx 2.9 then I would be open to that change. The 2.9 release series is a good time to introduce a change for the better default behavior.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en