I very much appreciate the very quick reply, I tried using what you have
and it still didn't work and gave me the same error. I'm assuming I've done
something wrong.
My 'startme.spec' file is below
-----------------------------------------
# -*- mode: python -*-
a = Analysis(['C:\\Documents and Settings\\Tom\\Desktop\\ToPy
v0.001\\startme.py',
'C:\\Documents and Settings\\Tom\\Desktop\\ToPy v0.001\\irep.py',
'C:\\Documents and
Settings\\Tom\\Desktop\\ToPy v0.001\\webpro.py'],
pathex=['C:\\DOCUME~1\\Tom\\Desktop\\PYINST~1'],
hiddenimports=['wx.lib.pubsub.core',
'wx.lib.pubsub.setuparg1'],
hookspath='C:\\Documents and
Settings\\Tom\\Desktop\\pyinstaller-pyinstaller-2145d84\\newhooks\\')
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', 'startme.exe'),
debug=False,
strip=None,
upx=True,
console=True )
-------------------------------------------------
and the command im running (as startme.spec is in the same folder) is simply
----------------------------
python pyinstaller.py startme.spec
-----------------------------
Am I missing something? I've got that sneaky something simple is missing
feeling. I keep trying the same few things over and over again and all its
doing is making me realize first hand the definition of insanity. I don't
really know or understand wx or pyinstaller enough to know where to even
really start. I'm still just learning python.
Thanks again for your help.
On Thu, Jun 21, 2012 at 3:05 PM, Daniel Hyams <[email protected]> wrote:
> While I'm not proud of this (it's a complete hack), the following seems to
> work for me. This is with the pubsub included with wxpython 2.8.11 and
> later, and you must import in your application like this:
>
> from wx.lib.pubsub import setuparg1
> from wx.lib.pubsub import pub as Publisher
>
> I can only verify that this works with the arg1 protocol; it probably will
> with kwargs as well, but I have not verified.
>
> Anyway, here are the two hooks:
>
> hook-wx.lib.pubsub.core.py:
> ------------------------- cut here ----
> import os
> import sys
>
> def hook(mod):
> pth = str(mod.__path__[0])
> if os.path.isdir(pth):
> # if the user imported setuparg1, this is detected by the
> hook-wx.lib.pubsub.setuparg1.py hook. That
> # hook sets sys.wxpubsub to "arg1", and we set the appropriate path
> here.
> protocol = getattr(sys,'wxpubsub','kwargs')
> print "wx.lib.pubsub: Adding %s protocol path"%protocol
> mod.__path__.append(os.path.normpath(os.path.join(pth, protocol)))
>
> return mod
> ------------------------- cut here ----
>
> And this for hook-wx.lib.pubsub.setuparg1.py:
>
> ------------------------- cut here ----
> import os
> import sys
>
> # if the user imports setuparg1, we just set an attribute in sys that
> allows us to later find out
> # about this.
> sys.wxpubsub = "arg1"
>
> ------------------------- cut here ----
>
> I told you it was a hack! :O Maybe the pyinstaller folks who know what
> they are doing can look at this and determine the correct solution.
>
>
> On Thu, Jun 21, 2012 at 2:48 PM, Tom <[email protected]> wrote:
>
>> Was this ever resolved, I'm having trouble as well. My google-fu has
>> failed me the last couple days. I know its something simple I don't really
>> see anything in the last 6-8 months but I still cant get it to work.
>>
>> I'm using:
>> XP Pro SP3
>> Python V 2.7.3
>> wx.version returns '2.8.12.1 (msw-ansi)'
>> I have tried both stable pyinstaller and development one from yesterday
>> (possible version: 2145d84)
>>
>> When I switched from importing Publisher to
>>
>> I've even tried including this hook below:
>> import os
>>
>> def hook(mod):
>> pth = str(mod.__path__[0])
>> if os.path.isdir(pth):
>> mod.__path__.append(os.path.normpath(os.path.join(pth, 'kwargs')))
>> return mod
>>
>> After changing the publisher import:
>> from wx.lib.pubsub import setupkwargs
>> from wx.lib.pubsub import setuparg1
>> from wx.lib.pubsub import pub as Publisher
>> (I have tried every combination of the first two, with both, without one
>> or the other, and with only import Publisher..)
>> With one or the other I seem to get:
>>
>> C:\Documents and Settings\Tom>"C:\Documents and
>> Settings\Tom\Desktop\PyPackagers
>> \pyinstaller-pyinstaller-2145d84\dist\startme.exe"
>> Traceback (most recent call last):
>> File "<string>", line 7, in <module>
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\Py
>> Installer\loader\iu.py", line 431, in importHook
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\Py
>> Installer\loader\iu.py", line 480, in doimport
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\bu
>> ild\pyi.win32\startme\out00-PYZ.pyz\wx.lib.pubsub.pub", line 24, in
>> <module>
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\Py
>> Installer\loader\iu.py", line 386, in importHook
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\Py
>> Installer\loader\iu.py", line 480, in doimport
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\bu
>> ild\pyi.win32\startme\out00-PYZ.pyz\wx.lib.pubsub.core.listener", line
>> 13, in <m
>> odule>
>> File "C:\Documents and
>> Settings\Tom\Desktop\pyinstaller-pyinstaller-2145d84\Py
>> Installer\loader\iu.py", line 409, in importHook
>> ImportError: No module named listenerimpl
>>
>>
>>
>>
>> On Tuesday, February 7, 2012 7:12:55 PM UTC-5, marc wrote:
>>>
>>> Hi all;
>>>
>>> I can see this has been discussed before in previous emails, but after
>>> reading them, I still cannot resolve this issue.
>>> I am trying to use pyinstaller to build a Windows executable - where
>>> code makes use of :
>>>
>>> wx.lib.pubsub import Publisher
>>>
>>> ... allowing the model to notify the controller that a change has
>>> occurred.
>>>
>>> However, when the executable is run, I get a "ImportError: cannot
>>> import name Publisher" error.
>>> I've tried using all the different imports mentioned on various
>>> threads, most work from Python, but fail to import once run from a
>>> Windows executable built with pyinstaller
>>>
>>> Could someone please let me know - currently, what's the best work
>>> around for this issue? I'd really like to get this resolved.
>>>
>>> Many thanks for your help,
>>> Marc
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "PyInstaller" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/pyinstaller/-/9aFhWy6-PcoJ.
>>
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/pyinstaller?hl=en.
>>
>
>
>
> --
> Daniel Hyams
> [email protected]
>
> --
> You received this message because you are subscribed to the Google Groups
> "PyInstaller" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pyinstaller?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.