2.9.4 Demo not working for me / 2.9.4 PubSub issue

1) I downloaded wxPython 2.9.4.exe for 32 bit Windows/Python 2.7 and
installed it. I then also downloaded the latest 2.9 Demo. I run the
Demo and it opens a CMD window briefly then closes. My platform is
WinXP, using Python 2.7 when using 2.9.x branch...at least I think it
is set up to use Python 2.7 with wx2.9.x.

2) Trying to run my own code with wx2.9.4 and it is getting stuck at
any import of Publisher, such as like this:
from wx.lib.pubsub import Publisher

ImportError: cannot import name Publisher

I saw the release note that said "In order to continue using the
original "arg1" API you will need to import wx.lib.pubsub.setuparg1
before importing any other pubsub modules." and so, in case that was
the issue, did that, like so:

import wx.lib.pubsub.setuparg1
from wx.lib.pubsub import Publisher

but I get the same error. Seems this is unrelated to the note; is the
Publisher class renamed?

Thanks,
Che

1) I downloaded wxPython 2.9.4.exe for 32 bit Windows/Python 2.7 and
installed it. I then also downloaded the latest 2.9 Demo. I run the
Demo and it opens a CMD window briefly then closes. My platform is
WinXP, using Python 2.7 when using 2.9.x branch...at least I think it
is set up to use Python 2.7 with wx2.9.x.

Do you see any more info if you start the demo from a command-line prompt using "c:\path\to\python27\python.exe demo.py"?

2) Trying to run my own code with wx2.9.4 and it is getting stuck at
any import of Publisher, such as like this:
from wx.lib.pubsub import Publisher

ImportError: cannot import name Publisher

I saw the release note that said "In order to continue using the
original "arg1" API you will need to import wx.lib.pubsub.setuparg1
before importing any other pubsub modules." and so, in case that was
the issue, did that, like so:

import wx.lib.pubsub.setuparg1
from wx.lib.pubsub import Publisher

but I get the same error. Seems this is unrelated to the note; is the
Publisher class renamed?

See http://pubsub.sourceforge.net/recipes/upgrade_v1tov3.html#label-upgrade-for-wx See step 3.3, it looks like you need to change Publisher to pub.

···

On 7/27/12 2:35 PM, C M wrote:

--
Robin Dunn
Software Craftsman

1) I downloaded wxPython 2.9.4.exe for 32 bit Windows/Python 2.7 and
installed it. I then also downloaded the latest 2.9 Demo. I run the
Demo and it opens a CMD window briefly then closes. My platform is
WinXP, using Python 2.7 when using 2.9.x branch...at least I think it
is set up to use Python 2.7 with wx2.9.x.

Do you see any more info if you start the demo from a command-line prompt
using "c:\path\to\python27\python.exe demo.py"?

No. If I'm in the CMD.exe ("DOS") window and type this once I'm in
the Python27 directory, this is what I get:

C:\Python27>python.exe demo.py
python.exe: can't open file 'demo.py': [Errno 2] No such file or directory

I have all of these installed on this computer: Python 2.5, Python
2.7, wxPython 2.8.10, wxPython 2.9.4 (and there is also a folder of
2.9.3 but not sure if 2.9.4 takes precedence). Something of a mess,
so if I can get this clear as to what demo is supposed to be where, I
hopefully can get it to work. Any guidance appreciated.

See
http://pubsub.sourceforge.net/recipes/upgrade_v1tov3.html#label-upgrade-for-wx
See step 3.3, it looks like you need to change Publisher to pub.

Thanks--I'll make those changes.

Che

If you are in the python directory then you need to type:
python \path_to_demo\demo.py
If you allowed the default path to be used this will look like:
C:\Python27>python "c:\Program Files\wxPython2.9 Docs and
Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that
should run it and selecting properties.

Gadget/Steve

···

On 29/07/2012 2:04 AM, C M wrote:

1) I downloaded wxPython 2.9.4.exe for 32 bit Windows/Python 2.7 and
installed it. I then also downloaded the latest 2.9 Demo. I run the
Demo and it opens a CMD window briefly then closes. My platform is
WinXP, using Python 2.7 when using 2.9.x branch...at least I think it
is set up to use Python 2.7 with wx2.9.x.

Do you see any more info if you start the demo from a command-line prompt
using "c:\path\to\python27\python.exe demo.py"?

No. If I'm in the CMD.exe ("DOS") window and type this once I'm in
the Python27 directory, this is what I get:

C:\Python27>python.exe demo.py
python.exe: can't open file 'demo.py': [Errno 2] No such file or directory

I have all of these installed on this computer: Python 2.5, Python
2.7, wxPython 2.8.10, wxPython 2.9.4 (and there is also a folder of
2.9.3 but not sure if 2.9.4 takes precedence). Something of a mess,
so if I can get this clear as to what demo is supposed to be where, I
hopefully can get it to work. Any guidance appreciated.

See
http://pubsub.sourceforge.net/recipes/upgrade_v1tov3.html#label-upgrade-for-wx
See step 3.3, it looks like you need to change Publisher to pub.

Thanks--I'll make those changes.

Che

If you are in the python directory then you need to type:
python \path_to_demo\demo.py
If you allowed the default path to be used this will look like:
C:\Python27>python "c:\Program Files\wxPython2.9 Docs and
Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that
should run it and selecting properties.

Gadget/Steve

Thanks, Gadget/Steve. OK, I see now what--probably--the issue is. When I
did this I got a msgdialog that said I was using wxPython 2.8.12.1.
This must be set as my default version (since I hadn't been ready to
make the jump to 2.9).

I then also get the error, which I assume is due to this:
AttributeError: 'MyApp' object has no attribute 'InitInspection'

So is there a way I can add a flag or something to the command to open
the demo using wx2.9.4?

Thanks,
Che

Che,

The fix I used was to add to the file Main.py in the demo directory the
following lines just after the initial comments and before the first import:

import wxversion
wxversion.select('2.9.4')

BUT to be able to save the file, (thanks to windows protection
policies), I had to uninstall the package from the default location and
install it in a writable one - I actually used a subdirectory under
c:\Python27 - personally I think that it is a poor choice of default
installation directory to put documentation and demo files under
"Program Files" for a package that is normally installed under PythonXY.

Gadget/Steve

···

On 29/07/2012 6:32 AM, C M wrote:

If you are in the python directory then you need to type:
python \path_to_demo\demo.py
If you allowed the default path to be used this will look like:
C:\Python27>python "c:\Program Files\wxPython2.9 Docs and
Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that
should run it and selecting properties.

Gadget/Steve

Thanks, Gadget/Steve. OK, I see now what--probably--the issue is. When I
did this I got a msgdialog that said I was using wxPython 2.8.12.1.
This must be set as my default version (since I hadn't been ready to
make the jump to 2.9).

I then also get the error, which I assume is due to this:
AttributeError: 'MyApp' object has no attribute 'InitInspection'

So is there a way I can add a flag or something to the command to open
the demo using wx2.9.4?

Thanks,
Che

If you are in the python directory then you need to type:
python \path_to_demo\demo.py
If you allowed the default path to be used this will look like:
C:\Python27>python "c:\Program Files\wxPython2.9 Docs and
Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that
should run it and selecting properties.

Gadget/Steve

Thanks, Gadget/Steve. OK, I see now what--probably--the issue is. When I
did this I got a msgdialog that said I was using wxPython 2.8.12.1.
This must be set as my default version (since I hadn't been ready to
make the jump to 2.9).

I then also get the error, which I assume is due to this:
AttributeError: 'MyApp' object has no attribute 'InitInspection'

So is there a way I can add a flag or something to the command to open
the demo using wx2.9.4?

Thanks,
Che

Che,

The fix I used was to add to the file Main.py in the demo directory the
following lines just after the initial comments and before the first import:

import wxversion
wxversion.select('2.9.4')

BUT to be able to save the file, (thanks to windows protection
policies), I had to uninstall the package from the default location and
install it in a writable one - I actually used a subdirectory under
c:\Python27 - personally I think that it is a poor choice of default
installation directory to put documentation and demo files under
"Program Files" for a package that is normally installed under PythonXY.

Gadget/Steve

Got it working, launched with a batch file, thanks to all the advice.
Much appreciated. I agree that Program Files is perhaps an odd choice
for this. I put it under Python27/Lib/site-packages.

Che

···

On Sun, Jul 29, 2012 at 1:58 AM, Gadget/Steve <GadgetSteve@live.co.uk> wrote:

On 29/07/2012 6:32 AM, C M wrote:

Hi Che,

···

On Sunday, July 29, 2012 4:10:34 PM UTC-5, Che M wrote:

On Sun, Jul 29, 2012 at 1:58 AM, Gadget/Steve GadgetSteve@live.co.uk wrote:

On 29/07/2012 6:32 AM, C M wrote:

If you are in the python directory then you need to type:

python \path_to_demo\demo.py

If you allowed the default path to be used this will look like:

C:\Python27>python "c:\Program Files\wxPython2.9 Docs and

Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that

should run it and selecting properties.

Gadget/Steve

Thanks, Gadget/Steve. OK, I see now what–probably–the issue is. When I

did this I got a msgdialog that said I was using wxPython 2.8.12.1.

This must be set as my default version (since I hadn’t been ready to

make the jump to 2.9).

I then also get the error, which I assume is due to this:

AttributeError: ‘MyApp’ object has no attribute ‘InitInspection’

So is there a way I can add a flag or something to the command to open

the demo using wx2.9.4?

Thanks,

Che

Che,

The fix I used was to add to the file Main.py in the demo directory the

following lines just after the initial comments and before the first import:

import wxversion

wxversion.select(‘2.9.4’)

BUT to be able to save the file, (thanks to windows protection

policies), I had to uninstall the package from the default location and

install it in a writable one - I actually used a subdirectory under

c:\Python27 - personally I think that it is a poor choice of default

installation directory to put documentation and demo files under

“Program Files” for a package that is normally installed under PythonXY.

Gadget/Steve

Got it working, launched with a batch file, thanks to all the advice.

Much appreciated. I agree that Program Files is perhaps an odd choice

for this. I put it under Python27/Lib/site-packages.

Che

When I ran into this, I just edited the shortcut’s target by right-clicking and going to properties. Then I changed it like this:

C:\Python27\pythonw.exe “C:\Program Files (x86)\wxPython2.9 Docs and Demos\demo\demo.pyw”

I also changed the name of the shortcut so I knew it was my 2.9 one. Then it launched correctly every time. This way I don’t have to move wxPython so some odd spot or anything.

  • Mike

You can also edit the wx.pth file to change which wx appears by default on the sys.path.

···

On 7/28/12 10:32 PM, C M wrote:

If you are in the python directory then you need to type:
python \path_to_demo\demo.py
If you allowed the default path to be used this will look like:
C:\Python27>python "c:\Program Files\wxPython2.9 Docs and
Demos\demo\demo.py"

you can find the path to the demo by right clicking on the icon that
should run it and selecting properties.

Gadget/Steve

Thanks, Gadget/Steve. OK, I see now what--probably--the issue is. When I
did this I got a msgdialog that said I was using wxPython 2.8.12.1.
This must be set as my default version (since I hadn't been ready to
make the jump to 2.9).

I then also get the error, which I assume is due to this:
AttributeError: 'MyApp' object has no attribute 'InitInspection'

So is there a way I can add a flag or something to the command to open
the demo using wx2.9.4?

--
Robin Dunn
Software Craftsman