Still at it. I recently upgraded to Windows XP, Python 2.7, wxpython 2.8.12
and pyinstaller 1.5.1
Things worked for python2.5, wxpython 2.8.10 and pyinstaller 1.4-rc1 but have
stopped since.
I have nailed some things down. As being told I created a spec file from
scratch which somehow made the win32api issue disappear.
Now I am having trouble with wxpython 2.8.12 since it incorporates a changes
handling of pubsub.
Here is the relevant bits from GNUmed.
try:
import wx
import wx.lib.pubsub
except ImportError:
print "GNUmed startup: Cannot import wxPython library."
print "GNUmed startup: Make sure wxPython is installed."
print 'CRITICAL ERROR: Error importing wxPython. Halted.'
raise
and it is used like this ...
wx.lib.pubsub.Publisher().subscribe(listener = self._on_set_statustext_pubsub,
topic = 'statustext')
That works unfrozen but not when being frozen
In outPYZ1.pyz I can see (ArchiveViewer) that some bits of pubsub are included
but nothing with publish.
The I by chance found this hook
http://code.google.com/p/bfplusplus/source/browse/trunk/scripts/hooks/hook-
wx.lib.pubsub.core.py?spec=svn127&r=127
After placing it in the hooks directory I suddenly see more bits of pubsub
appearing including some references to publish.
Still when I start the binary I crashes with the message.
no module named Publish. The code in question is this:
wx.lib.pubsub.Publisher().subscribe(listener = self._on_set_statustext_pubsub,
topic = 'statustext')
It seems Publish() still cannot be called. Maybe there is still some stuff
missing (unpackaged).
Any help is appreciated.
Sebastian
Hi all,
I have for test purposes modified the GNUmed code from
>
> try:
> import wx
> import wx.lib.pubsub
>
> except ImportError:
> print "GNUmed startup: Cannot import wxPython library."
> print "GNUmed startup: Make sure wxPython is installed."
> print 'CRITICAL ERROR: Error importing wxPython. Halted.'
> raise
>
>
>
try:
import wx
import wx.lib.pubsub
from wx.lib.pubsub import pub as Publisher
except ImportError:
print "GNUmed startup: Cannot import wxPython library."
And further down
>wx.lib.pubsub.Publisher().subscribe(listener =
self._on_set_statustext_pubsub, topic = 'statustext')
to
Publisher.subscribe(listener = self._on_set_statustext_pubsub, topic =
'statustext')
Now it runs frozen but when hitting the above line it says:
subscribe got an unexpected keyword 'topic'
I am lost. Any help is appreciated.
Sebastian
http://www.pyinstaller.org/ticket/312
So I am looking for a solution where I don't have to modify the code but
>wx.lib.pubsub.Publisher().subscribe(listener =
>self._on_set_statustext_pubsub, topic = 'statustext')
would work out of the box.
Regards,
Sebastian Hilbert
GNUmed project
Hi Sebastian,
can you please attach to the ticket a small source code that reproduces
the issue?
--
Giovanni Bajo :: ra...@develer.com
Develer S.r.l. :: http://www.develer.com
My Blog: http://giovanni.bajo.it
Hi,
> Hi Sebastian,
>
> can you please attach to the ticket a small source code that reproduces
> the issue?
See code below. It is an example taken from
wiki.wxpython.org/WxLibPubSub
======================================
# first line below is necessary only in wxPython 2.8.11.0 since default
# API in this wxPython is pubsub version 1 (expect later versions
# of wxPython to use the kwargs API by default)
from wx.lib.pubsub import setupkwargs
# regular pubsub import
from wx.lib.pubsub import pub
class SomeReceiver(object):
def __init__(self):
pub.subscribe(self.__onObjectAdded, 'object.added')
def __onObjectAdded(self, data, extra1, extra2=None):
# no longer need to access data through message.data.
print 'Object', repr(data), 'is added'
print extra1
if extra2:
print extra2
a = SomeReceiver()
pub.sendMessage('object.added', data=42, extra1='hello!')
pub.sendMessage('object.added', data=42, extra1='hello!', extra2=[2, 3, 5, 7,
11, 13, 17, 19, 23])
=============================
I cannot make it freeze on pyinstaller 1.5.1
Here is the spec file created by pyinstaller's MakeSpec
=============================
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),
os.path.join(HOMEPATH,'support\\useUnicode.py'), 'c:
\\Temp\\pubsub\\pubsub.py'],
pathex=['C:\\Temp\\pubsub'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build\\pyi.win32\\pubsub', 'pubsub.exe'),
debug=False,
strip=False,
upx=False,
console=True )
coll = COLLECT( exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
name=os.path.join('dist', 'pubsub'))
============================
Once this properly freezes I could have a look at the GNUmed specific bits.
wxpython is 2.8.12.1 for python 2.7
Your help is appreciated.
Sebastian
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
======================================
# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),
os.path.join(HOMEPATH,'support\\useUnicode.py'), 'c:
\\Temp\\pubsub\\pubsub.py'],
pathex=['C:\\Temp\\pubsub'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=1,
name=os.path.join('build\\pyi.win32\\pubsub', 'pubsub.exe'),
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT( exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name=os.path.join('dist', 'pubsub'))
===================================
# first line below is necessary only in wxPython 2.8.11.0 since default
# API in this wxPython is pubsub version 1 (expect later versions
# of wxPython to use the kwargs API by default)
from wx.lib.pubsub import setupkwargs
# regular pubsub import
from wx.lib.pubsub import pub
class SomeReceiver(object):
def __init__(self):
pub.subscribe(self.__onObjectAdded, 'object.added')
def __onObjectAdded(self, data, extra1, extra2=None):
# no longer need to access data through message.data.
print 'Object', repr(data), 'is added'
print extra1
if extra2:
print extra2
a = SomeReceiver()
pub.sendMessage('object.added', data=42, extra1='hello!')
pub.sendMessage('object.added', data=42, extra1='hello!', extra2=[2, 3, 5, 7,
11, 13, 17, 19, 23])
=======================================
Thanks,
Sebastian
Hi Daniel,
Thanks a lot for looking into this.
I have tested your attached files and copied the hooks to the hooks directory.
Unfortunately on my Windows XP installation with wxpython 2.8.12.1 (python
2.7) things still don't quite work out.
the arg1 version freezes ok and fails when running with a message:
==========================================
import errno # builtin
import _weakref # builtin
import _sre # builtin
import operator # builtin
import _functools # builtin
import _locale # builtin
import wx._gdi_ # dynamically loaded from C:
\Temp\pubsub\dist\test_wxpubsub_arg
\wx._gdi_.pyd
import wx._windows_ # dynamically loaded from C:
\Temp\pubsub\dist\test_wxpubsub
arg1\wx._windows_.pyd
import wx._controls_ # dynamically loaded from C:
\Temp\pubsub\dist\test_wxpubsu
_arg1\wx._controls_.pyd
import wx._misc_ # dynamically loaded from C:
\Temp\pubsub\dist\test_wxpubsub_ar
1\wx._misc_.pyd
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name Publisher
RC: -1 from test_wxpubsub_arg1
OK.
C:\Temp\pubsub>
=============================
your kwargs version now freezes ok and runs ok.
Thanks for that.
Sebastian
Sebastian
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
Hi,
> Hmm, strange. Differences that we hIt ave are that I'm using wxPython
> 2.9.1.1, Python 2.6.6, and Windows 7. Best guess is that wxPython 2.9
> series ships with a different version of pubsub than 2.8?
>
That could very well be possible. I have seen reports where people have
replace the included pubsub with something from sourceforge.
I will try 2.9 on Windows then. Let's see what happens :-)
> It is possible, too, that I hacked my own pubsub a long time ago and forgot
> about it...I did a lot of fussing a year ago to try to make the freezing
> work and was never successful. I'll try the test suite on a fresh linux
> install and see what happens.
>
That would be excellent. Could even be the case that my system is screwed up.
As I mentioned. version 3 api works ok. v1 api fails with
ImportError: cannot import name Publisher
RC: -1 from gnumed
OK.
Thanks for your effort.
Sebastian
On Tuesday, December 13, 2011 01:21:51 PM Daniel Hyams wrote:
Hi,
That could very well be possible. I have seen reports where people have
> Hmm, strange. Differences that we hIt ave are that I'm using wxPython
> 2.9.1.1, Python 2.6.6, and Windows 7. Best guess is that wxPython 2.9
> series ships with a different version of pubsub than 2.8?
>
replace the included pubsub with something from sourceforge.
from wx.lib.pubsub import Publisher
which supposedly initiates version 1.
Will try the other syntax now.
Sebastian
if not hasattr(sys, 'frozen'):
import wxversion
wxversion.ensureMinimal('2.8-unicode', optionsRequired=True)
try:
import wx
from wx.lib.pubsub import setupv1
from wx.lib.pubsub import pub as Publisher
Here it is:
File "C:\workplace\gnumed-
client.1.1.6\build\pyi.win32\setup\outPYZ1.pyz/wx.li
b.pubsub.setupv1", line 16, in <module>
File "C:\workplace\gnumed-
client.1.1.6\build\pyi.win32\setup\outPYZ1.pyz/wx.li
b.pubsub.pubsubconf", line 16, in setVersion
File "C:\workplace\gnumed-
client.1.1.6\build\pyi.win32\setup\outPYZ1.pyz/wx.li
b.pubsub.pubsubconf", line 51, in setVersion
AssertionError
RC: -1 from gnumed
OK.
Regards,
Sebastian
Sebastian
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
Sebastian
Sebastian
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
I have tested the examples you provided once again.
It seems that both do work despite me saying that arg1 does not work
yesterday.
So from what I can say now is that arg1 and kwargs examples seem to work.
setupv1 has not been tested yet.
Sebastian
I wonder if the setupv1 version can be made to work. Hopefully it does not
require upstream changes.
Sebastian
---------------------------------
--------------------------------------
Sebastian
Sebastian
--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
HI Daniel,
Thanks for all your effort.
> I unfortunately have not been able to get setupv1 to work. It has a couple
> of problems that I do not know how to surmount. The first is that it
> asserts if it finds that it has more than one path in its own __path__;
> when frozen, this will be the case, so the assert fails. The assert was
> unnecessary, so I removed it...but then, freezing with the v1 api active is
> successful, but nothing happens when the pubsub messages are sent, for a
> reason I was unable to determine.
>
Thats is unfortunate but so be it.
> I did take a quick look at GNUmed, and it looks like it would be a trivial
> matter to convert it to use the v3 api. Just put "from wx.lib.pubsub
> import setuparg1" before the importing of wx.lib.pubsub in gmGuiMain.py,
> and then replace all instances of Publisher() with pub, and it should work
> fine (there are about ten of them).
>
I have done tests yesterday and those get as far as I can freeze successfully.
However when acutally running the code I get some syntax errors.
Will have another look today.
Sebastian
Thanks to you both.
I've seen Sebastian already documented the state of your research in
#312. Thanks for this. If you finish the research please drop us a note.
At least I am not able to completely follow this discussion.
--
Sch�nen Gru� - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP
Goebel Consult
Spezialist f�r IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de
Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de
Hi Hartmut,
> > Thanks for all your effort.
>
> Thanks to you both.
>
> I've seen Sebastian already documented the state of your research in
> #312. Thanks for this. If you finish the research please drop us a note.
> At least I am not able to completely follow this discussion.
One of the most important aspects of Daniel's findings is that
pure v1 api does not work with pyinstaller (yet). Daniel stated that he found
one problem which led to successfull freezing but the frozen code did not run
properly.
Even though it has been a nice step forward to see arg1 and kwargs api
supported it is problematic not having pure v1 api going.
We really should try to solve this because
a) any other api requires code changes to the upstream software
b) it worked on pyinstaller 1.4 (given that it was different) so users might
perceive pyinstaller as broken (while technically it is not)
So if anyone could figure out how to get pure v1 api to work htat would be
great.
I can supply another test case and spec file for any dev who wants to attempt
this. Once again kudos to Daniel who did all the hard work so far.
Sebastian
hi the following has me confused:
"The correct path (core/arg1 or core/kwargs) must be added (and only the correct one) depending on whether or not setuparg1 has been imported"
where do i put this path?
To view this discussion on the web visit https://groups.google.com/d/msg/pyinstaller/-/pBevZSBhds4J.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.