allow to run as wxpython 2.8.x or 2.9.x ?

I have been developing with wxPython 2.8.10 and have recently begun trying 2.9.3.1. I want to have one set of code that will run no matter which of those versions of wxPython is used to run it. I would think just using some variation on a try/except with wxversion.select() would work, but I get a problem…

If I run the app (via Boa Constructor, my IDE) with these as the first lines:

import wxversion
wxversion.select(‘2.9’)

It works fine ONLY if I am running Boa with Python 2.7 and wxPython 2.9.3.1. (Which are in the C:\Python27 path).

… but if I run Boa from the C:/Python25 path, which as you ca see below does have a wxPython 2.9.3 install, it–strangely–gives me a syntax error:

File “C:\Python25\lib\site-packages\wx-2.9.3-msw\wx_core.py”, line 8704

class PySimpleApp(wx.App):
    ^

SyntaxError: invalid syntax

I don’t get why that should be a syntax error. Even if I wrap the wxversion.select() line in a try/except block I still get a syntax error…therefore it is executing the wxversion.select() fine, but it is choking on the PySimpleApp. But I don’t understand, since this does work when I run Boa from the other location.

So that’s my first question–why?

My goal though is I basically want it to be able to run 2.9.3 if Boa starts with 2.9.3 and 2.8.10 if Boa starts with 2.8.10. Is there a way to do this?

I hope I’m being clear enough. It’s a little hard to explain.

Thanks,
Che

C M wrote:

...
It works fine ONLY if I am running Boa with Python 2.7 and wxPython
2.9.3.1. (Which are in the C:\Python27 path).

... but if I run Boa from the C:/Python25 path, which as you ca see
below does have a wxPython 2.9.3 install, it--strangely--gives me a
*syntax* error:

  File "C:\Python25\lib\site-packages\wx-2.9.3-msw\wx\_core.py", line 8704
    class PySimpleApp(wx.App):
        ^
SyntaxError: invalid syntax

I don't get why that should be a syntax error.

It's because of the line directly above that one:
    @wx.deprecated
    class PySimpleApp(wx.App):

Class decorators were not introduced until Python 2.6.

So that's my first question--why?

My goal though is I basically want it to be able to run 2.9.3 if Boa
starts with 2.9.3 and 2.8.10 if Boa starts with 2.8.10. Is there a
way to do this?

wxPython 2.9 requires Python 2.6.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Class decorators were not introduced until Python 2.6.

Ahhh. Makes complete sense now. Something like that should have occurred to me. Thanks!

I have been developing with wxPython 2.8.10 and have recently begun trying 2.9.3.1. I want to have one set of code that will run no matter which of those versions of wxPython is used to run it. I would think just using some variation on a try/except with wxversion.select() would work, but I get a problem…

If I run the app (via Boa Constructor, my IDE) with these as the first lines:

import wxversion
wxversion.select(‘2.9’)

It works fine ONLY if I am running Boa with Python 2.7 and wxPython 2.9.3.1. (Which are in the C:\Python27 path).

… but if I run Boa from the C:/Python25 path, which as you ca see below does have a wxPython 2.9.3 install, it–strangely–gives me a syntax error:

File “C:\Python25\lib\site-packages\wx-2.9.3-msw\wx_core.py”, line 8704

class PySimpleApp(wx.App):

    ^

SyntaxError: invalid syntax

I don’t get why that should be a syntax error. Even if I wrap the wxversion.select() line in a try/except block I still get a syntax error…therefore it is executing the wxversion.select() fine, but it is choking on the PySimpleApp. But I don’t understand, since this does work when I run Boa from the other location.

By the way, because the syntax error is further down the code that the wxversion.select() line, it doesn’t necessarily mean that the line executed fine. In fact it wont have even tried because the script wont run at all if it detects a syntax error.

···

On 13 April 2012 00:07, C M cmpython@gmail.com wrote:

So that’s my first question–why?

My goal though is I basically want it to be able to run 2.9.3 if Boa starts with 2.9.3 and 2.8.10 if Boa starts with 2.8.10. Is there a way to do this?

I hope I’m being clear enough. It’s a little hard to explain.

Thanks,
Che

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

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