|
From: Sandro T. <mo...@de...> - 2009-03-06 21:12:30
|
Hello,
we are facing a problem in Debian where a user has problems running
embedding_in_wx*.py examples.
The problem is:
>>> from wx import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__DocFilter'
>>> import wx
>>> print wx.__version__
2.6.3.2
Since WX2.8 is the one to use, the solution is simple:
>>> import wxversion
>>> wxversion.select('2.8')
>>> from wx import *
>>> wx.__version__
'2.8.7.1'
That solves the problem of multi-wx on a system.
What do you think about adding those 2 line into wx examples?
Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
|
|
From: Sandro T. <mo...@de...> - 2009-03-06 21:24:29
|
On Fri, Mar 6, 2009 at 22:12, Sandro Tosi <mo...@de...> wrote:
>>>> import wxversion
>>>> wxversion.select('2.8')
>>>> from wx import *
>>>> wx.__version__
> '2.8.7.1'
>
> That solves the problem of multi-wx on a system.
>
> What do you think about adding those 2 line into wx examples?
Moreover, I will provide a patch to move from
>>> from wx import *
to
>>> import wx
that's much more clear. Just let me know if in the patch I will add
the wxversion.select or no.
Regards,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
|
|
From: Sandro T. <mo...@de...> - 2009-03-10 23:35:00
Attachments:
examples_wx2.8_import.patch
|
On Fri, Mar 6, 2009 at 22:24, Sandro Tosi <mo...@de...> wrote:
> On Fri, Mar 6, 2009 at 22:12, Sandro Tosi <mo...@de...> wrote:
>>>>> import wxversion
>>>>> wxversion.select('2.8')
>>>>> from wx import *
>>>>> wx.__version__
>> '2.8.7.1'
>>
>> That solves the problem of multi-wx on a system.
>>
>> What do you think about adding those 2 line into wx examples?
>
> Moreover, I will provide a patch to move from
Here it is the promised patch (sorry for the late, that proves how
busy I am these days).
It uses the 'wxversion.ensureMinimal' function as Chris pointed out,
and move from "from wx import *" to "import wx".
I tested them on a sys (Debian sid) with both wx2.6 and wx2.8: before
the patch the examples goes in abort, after they select wx2.8 and uses
it displaying the windows (even though ex2 and 3 seems a little "too
compress" do not know if it's due to code or patch ;) ).
HTH, cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
|
|
From: Eric F. <ef...@ha...> - 2009-03-06 22:00:58
|
Sandro Tosi wrote:
> On Fri, Mar 6, 2009 at 22:12, Sandro Tosi <mo...@de...> wrote:
>>>>> import wxversion
>>>>> wxversion.select('2.8')
>>>>> from wx import *
>>>>> wx.__version__
>> '2.8.7.1'
>>
>> That solves the problem of multi-wx on a system.
>>
>> What do you think about adding those 2 line into wx examples?
>
> Moreover, I will provide a patch to move from
>
>>>> from wx import *
>
> to
>
>>>> import wx
>
> that's much more clear. Just let me know if in the patch I will add
> the wxversion.select or no.
>
> Regards,
Sounds good to me, but I am not a wx user, so I might be missing
something. The only reservation that occurs to me is this: suppose
version 2.10 comes out, and someone has only that installed. Is there a
way to select 2.8 or higher, instead of requiring 2.8?
Eric
|
|
From: Sandro T. <mo...@de...> - 2009-03-06 23:06:39
|
On Fri, Mar 6, 2009 at 23:00, Eric Firing <ef...@ha...> wrote:
> Sandro Tosi wrote:
>>
>> On Fri, Mar 6, 2009 at 22:12, Sandro Tosi <mo...@de...> wrote:
>>>>>>
>>>>>> import wxversion
>>>>>> wxversion.select('2.8')
>>>>>> from wx import *
>>>>>> wx.__version__
>>>
>>> '2.8.7.1'
>>>
>>> That solves the problem of multi-wx on a system.
>>>
>>> What do you think about adding those 2 line into wx examples?
>>
>> Moreover, I will provide a patch to move from
>>
>>>>> from wx import *
>>
>> to
>>
>>>>> import wx
>>
>> that's much more clear. Just let me know if in the patch I will add
>> the wxversion.select or no.
>>
>> Regards,
>
> Sounds good to me, but I am not a wx user, so I might be missing something.
> The only reservation that occurs to me is this: suppose version 2.10 comes
> out, and someone has only that installed. Is there a way to select 2.8 or
> higher, instead of requiring 2.8?
AFAIUI, it's not possible to say "2.8+" == "2.8 and all the higher
versions", but we can specify a list of version to be searched, the
first match is the one "mapped" as default wx. If no-one of the
specified version are available, then an exception is thrown:
>>> import wxversion
>>> wxversion.select(['2.5','2.3','2.9'])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/wxversion.py", line 149, in select
raise VersionError("Requested version of wxPython not found")
wxversion.VersionError: Requested version of wxPython not found
>>> wxversion.select(['2.5','2.3','2.8'])
>>> import wx
>>> wx.__version__
'2.8.7.1'
In any case, the example code doesn't work with wx2.6 so, as even a
temporary workaround, I think we should enforce the needs for wx2.8.
Cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
|
|
From: Christopher B. <Chr...@no...> - 2009-03-09 20:55:31
|
Sandro Tosi wrote:
>>>>>>> import wxversion
>>>>>>> wxversion.select('2.8')
>>>>>>> from wx import *
>>>>>>> wx.__version__
>>>> '2.8.7.1'
>>>>
>>>> That solves the problem of multi-wx on a system.
>>>>
>>>> What do you think about adding those 2 line into wx examples?
hmmm - only the examples? or should it be in the wx back-end itself?
Maybe at least a version check?
Anyway -- certainly the examples
>>> Moreover, I will provide a patch to move from
>>>
>>>>>> from wx import *
>>> to
>>>>>> import wx
who hoo! thanks!
> AFAIUI, it's not possible to say "2.8+" == "2.8 and all the higher
> versions",
I think there is:
http://www.wxpython.org/docs/api/wxversion-module.html
you need:
import wxversion
wxversion.ensureMinimal('2.8')
I think that will do it, but I haven't tested much -- I only have one
version installed now. If it does work, I say we definitely ue it in the.
Another option is to put it in the wx back-end in a try block:
wxversion.ensureMinimal('2.4')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/wxPython-unicode-2.8.9.1/lib/python2.5/site-packages/wxversion.py",
line 181, in ensureMinimal
raise AlreadyImportedError("wxversion.ensureMinimal() must be
called before wxPython is imported")
wxversion.AlreadyImportedError: wxversion.ensureMinimal() must be called
before wxPython is imported
which might be the safest, and would catch both pylab use, and people's
home-written apps that need the wxversion call.
thanks for working on this,
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|
|
From: Sandro T. <mo...@de...> - 2009-03-09 22:26:13
|
On Mon, Mar 9, 2009 at 21:55, Christopher Barker <Chr...@no...> wrote:
> Sandro Tosi wrote:
>>>>>>>> import wxversion
>>>>>>>> wxversion.select('2.8')
>>>>>>>> from wx import *
>>>>>>>> wx.__version__
>>>>> '2.8.7.1'
>>>>>
>>>>> That solves the problem of multi-wx on a system.
>>>>>
>>>>> What do you think about adding those 2 line into wx examples?
>
> hmmm - only the examples? or should it be in the wx back-end itself?
> Maybe at least a version check?
I'll leave this to the mpl gurus...
> Anyway -- certainly the examples
...while I'll concentrate on them :)
>>>> Moreover, I will provide a patch to move from
>>>>
>>>>>>> from wx import *
>>>> to
>>>>>>> import wx
>
> who hoo! thanks!
>
>> AFAIUI, it's not possible to say "2.8+" == "2.8 and all the higher
>> versions",
>
> I think there is:
>
> http://www.wxpython.org/docs/api/wxversion-module.html
>
> you need:
>
> import wxversion
> wxversion.ensureMinimal('2.8')
>
> I think that will do it, but I haven't tested much -- I only have one
> version installed now. If it does work, I say we definitely ue it in the.
>
> Another option is to put it in the wx back-end in a try block:
>
> wxversion.ensureMinimal('2.4')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File
> "/usr/local/lib/wxPython-unicode-2.8.9.1/lib/python2.5/site-packages/wxversion.py",
> line 181, in ensureMinimal
> raise AlreadyImportedError("wxversion.ensureMinimal() must be
> called before wxPython is imported")
> wxversion.AlreadyImportedError: wxversion.ensureMinimal() must be called
> before wxPython is imported
>
> which might be the safest, and would catch both pylab use, and people's
> home-written apps that need the wxversion call.
yeah, that's what we need: I got 2 version installed (2.6 and 2.8) and
here is the output
In [1]: import wxversion
In [2]: help(wxversion.ensureMinimal)
In [3]: wxversion.ensureMinimal('2.6')
In [4]: import wx
In [5]: wx.__version__
Out[5]: '2.6.3.2'
and
In [2]: import wxversion
In [3]: wxversion.ensureMinimal('2.8')
In [4]: import wx
In [5]: wx.__version__
Out[5]: '2.8.7.1'
So I'm going to use it in the examples. Thanks for spotting it out!
I only hope that 2.8->2.10 (or higher) would not introduce such corner
cases like in 2.6->2.8.
Cheers,
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi
|
|
From: Christopher B. <Chr...@no...> - 2009-03-09 23:26:04
|
Sandro Tosi wrote:
>>>>>> What do you think about adding those 2 line into wx examples?
>> hmmm - only the examples? or should it be in the wx back-end itself?
>> Maybe at least a version check?
>
> I'll leave this to the mpl gurus...
fair enough.
> yeah, that's what we need: I got 2 version installed (2.6 and 2.8) and
> here is the output
> In [2]: import wxversion
>
> In [3]: wxversion.ensureMinimal('2.8')
>
> In [4]: import wx
>
> In [5]: wx.__version__
> Out[5]: '2.8.7.1'
>
> So I'm going to use it in the examples. Thanks for spotting it out!
great -- thanks for working on those -- good examples are key!
> I only hope that 2.8->2.10 (or higher) would not introduce such corner
> cases like in 2.6->2.8.
Less likely, with 2.8, we eliminated the compiled parts of the wx
back-end, by using some new features.
However, if future versions of wxPython get the new enhanced buffer
interface, it might be nice to use it.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
|
|
From: Eric F. <ef...@ha...> - 2009-03-11 19:50:28
|
Sandro Tosi wrote:
> On Fri, Mar 6, 2009 at 22:24, Sandro Tosi <mo...@de...> wrote:
>> On Fri, Mar 6, 2009 at 22:12, Sandro Tosi <mo...@de...> wrote:
>>>>>> import wxversion
>>>>>> wxversion.select('2.8')
>>>>>> from wx import *
>>>>>> wx.__version__
>>> '2.8.7.1'
>>>
>>> That solves the problem of multi-wx on a system.
>>>
>>> What do you think about adding those 2 line into wx examples?
>> Moreover, I will provide a patch to move from
>
> Here it is the promised patch (sorry for the late, that proves how
> busy I am these days).
>
> It uses the 'wxversion.ensureMinimal' function as Chris pointed out,
> and move from "from wx import *" to "import wx".
>
> I tested them on a sys (Debian sid) with both wx2.6 and wx2.8: before
> the patch the examples goes in abort, after they select wx2.8 and uses
> it displaying the windows (even though ex2 and 3 seems a little "too
> compress" do not know if it's due to code or patch ;) ).
Sandro,
I have applied your patch, plus related changes to backend_wx and
backend_wxagg as suggested by Chris, to the 0.98.5 maintenance branch,
and then used svnmerge to propagate the changes to the trunk. (In other
words, I judged the changes to be a bug fix rather than a new feature.)
Eric
|
|
From: Sandro T. <mo...@de...> - 2009-03-11 19:58:33
|
On Wed, Mar 11, 2009 at 20:49, Eric Firing <ef...@ha...> wrote: > I have applied your patch, plus related changes to backend_wx and > backend_wxagg as suggested by Chris, to the 0.98.5 maintenance branch, and > then used svnmerge to propagate the changes to the trunk. (In other words, > I judged the changes to be a bug fix rather than a new feature.) Yes, indeed they are a bugfix... hence: thanks for merging them!! :) Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi |
|
From: Christopher B. <Chr...@no...> - 2009-03-11 20:59:22
|
Eric Firing wrote: > I have applied your patch, plus related changes to backend_wx and > backend_wxagg as suggested by Chris, to the 0.98.5 maintenance branch, > and then used svnmerge to propagate the changes to the trunk. (In other > words, I judged the changes to be a bug fix rather than a new feature.) Great, thanks! thanks for taking care of us wx users... -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |