On Mon, Jun 14, 2010 at 10:25 AM, Mike Driscoll <kyos...@gmail.com> wrote:
>
>
> On Jun 14, 10:24 am, Mike Driscoll <kyoso...@gmail.com> wrote:
>> Hi,
>>
>> I had to recompile some changes in one of my new applications today
>> and the resulting binary wouldn't run because it couldn't import
>> Pubsub. Since all I had added was a conditional, I knew it had to be
>> because I had upgraded to 2.8.11.0. The import call looks like this:
>>
>> from wx.lib.pubsub import Publisher
>>
>> The code runs fine from source, but when I try to build a binary using
>> GUI2Exe / py2exe, the result doesn't work. It immediately crashes with
>> a "cannot import Publisher" error.
>>
>> I tried to add Publisher as a module or a package, but I can't seem to
>> find the right way to do it yet. Does anyone have any ideas?
The new Pubsub in 2.8.11 is no longer a stand alone module, its a
package of a number of modules. I haven't looked at it in detail yet
so this is just a guess, but you probably will need to add something
like the following to your setup.py's includes.
includes = [ "wx.lib.pubsub.*" ]
Cody
I see the same on Win 7 and Py 2.6.5 when I just added the above import
to the sample wx app on the wiki page for py2exe.
Looking a bit into it it looks like the forcing to version one does not
work when frozen, see pubsub.__init__.py line 66 and 67, also
autosetuppubsubv1.pyo is present in the library.zip.
To work around I did this:
from wx.lib.pubsub import setupv1 as psv1
from wx.lib.pubsub import Publisher
And in the setup.py this:
packages = ['wx.lib.pubsub']
Hope this helps
Werner
On Jun 14, 11:03 am, werner <wbru...@free.fr> wrote:
> Hi Mike,
>
> On 14/06/2010 17:25, Mike Driscoll wrote:
>
>
>
> > On Jun 14, 10:24 am, Mike Driscoll<kyoso...@gmail.com> wrote:
>
> >> Hi,
>
> >> I had to recompile some changes in one of my new applications today
> >> and the resulting binary wouldn't run because it couldn't import
> >> Pubsub. Since all I had added was a conditional, I knew it had to be
> >> because I had upgraded to 2.8.11.0. The import call looks like this:
>
> >> from wx.lib.pubsub import Publisher
>
> >> The code runs fine from source, but when I try to build a binary using
> >> GUI2Exe / py2exe, the result doesn't work. It immediately crashes with
> >> a "cannot import Publisher" error.
>
> >> I tried to add Publisher as a module or a package, but I can't seem to
> >> find the right way to do it yet. Does anyone have any ideas?
>
> >> Thanks!
>
> >> - Mike
>
> > Forgot to mention this, but I'm on Windows XP, Python 2.5.4
> To work around I did this:
>
> from wx.lib.pubsub import setupv1 as psv1
> from wx.lib.pubsub import Publisher
>
> And in the setup.py this:
> packages = ['wx.lib.pubsub']
>
> Hope this helps
> Werner
Why do you rename to "psv1"? Anyway, I tried this and now the program
runs, however it fails on my sendMessage call:
Publisher().sendMessage(('window', 'closing'), ['ts_worksheet
closed'])
with this:
TypeError: sendMessage() takes exactly 2 arguments (3 given)
So I don't think its quite using the old API there. I don't know the
new API at the moment, but I guess I should just figure it out...
Thanks for the help though!
--
To unsubscribe, send email to wxPython-user...@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
I am doing this:
import sys
stdoutlog = file('py2test.log', 'a+')
sys.stdout = stdoutlog
sys.stderr = stdoutlog
import wx.lib.pubsub.setupv1
from wx.lib.pubsub import pub
print pub.VERSION_STR
Unfrozen I get:
1.1.200904.r159
Frozen I get:
3.1.1b1.201005.r243
Traceback (most recent call last):
File "simplewx.py", line 109, in <module>
File "simplewx.py", line 19, in create
File "simplewx.py", line 95, in __init__
TypeError: unbound method subscribe() must be called with
PublisherKwargs instance as first argument (got instancemethod instance
instead)
Will try and look into this some more later today or tomorrow afternoon.
Werner
Could you add this info to the wxPyWiki wherever it would be
appropriate? (On the pusub related pages and/or the py2exe pages, or
perhaps a new page linked to from those.) It would also be nice if you
could review the current pubsub pages and update them if needed.
Thanks.
--
Robin Dunn
Software Craftsman
http://wxPython.org
Could you add this info to the wxPyWiki wherever it would be appropriate? (On the pusub related pages and/or the py2exe pages, or perhaps a new page linked to from those.) It would also be nice if you could review the current pubsub pages and update them if needed.
Thanks.
import wx
from wx.lib.pubsub import setupv1from wx.lib.pubsub import Publisher
options = {"py2exe": {"dll_excludes": ["MSVCP90.dll"],"packages": ['wx.lib.pubsub'],}