OnEndEdit event duplicated on OS X

When recently testing, on Mac OS X, a wxPython application written mostly
on Windows, I encountered a problem whose root cause seems to be that the
tree control's OnEndEdit is being called twice.

I have confirmed that this happens in the wxPython demo too.

Is there a way to either:

  (1) prevent the second event from occurring; or
  (2) identify the second event as bogus so it can be ignored?

The only thing I can think of is a workaround where a flag is used to
ensure that an OnEndEdit without an OnBeginEdit is ignored.

Any help would be much appreciated.

Thanks!

James

···

--
  James Tauber
  http://jtauber.com/

Hi all,

I have upgraded Python and wxPython on my Redhat 9 system. Previous versions
are Python 2.2.3 and wxPython 2.4.0.2, new versions are Python 2.3.3c1 and
wxPython 2.4.2.4. Something has gone wrong.

If I go into the Python interpreter, and type "from wxPython.wx import *", I
get the following message -

ImportError: libwx_gtkd-2.4.so: cannot open shared object file: No such file
or directory

I will explain exactly what steps I have taken - hopefully someone can tell
me what I have done wrong.

When I installed Python, I did not want to overwrite the existing
installation, so following the instructions, I installed the new one like
so -

    ./configure
    make
    make altinstall

This puts the new version of Python in /usr/local/bin and /usr/local/lib,
leaving the original version in /usr/bin and /usr/lib. This seems to have
worked ok.

I installed wxPython from wxPythonGTK-py2.3-2.4.2.4-1.i386rpm. Before
installing it, I ran rpm with the -l option to see where it would put the
files. I could see some files going to /usr/bin, and others to /usr/lib.
After reading the rpm man pages, I decided to install wxPython with the
following options - --relocate /usr/bin=/usr/local/bin --relocate
/usr/lib=/usr/local/lib. This seemed to work ok.

I thought that I would be able to run the original Python from /usr/bin, and
it would automatically import the original wxPython, and I would be able to
run the new Python from /usr/local/bin, and it would automatically import
the new wxPython. However, not only do I get the above error message from
the new Python, I also get a similar error message if I try to run the
original one - the file name in the error message is libwx_gtk2ud-2.4.so, as
the previous version was compiled for GTK2.

I can probably fix the old version by reinstalling everything from scratch,
but I would prefer to understand what I have done wrong and fix it
correctly. Any information will be much appreciated.

Many thanks

Frank Millman

Frank Millman wrote:

I have upgraded Python and wxPython on my Redhat 9 system. Previous versions
are Python 2.2.3 and wxPython 2.4.0.2, new versions are Python 2.3.3c1 and
wxPython 2.4.2.4. Something has gone wrong.

I've had similar problems the last couple times, and it wasn't too big a
deal to solve them. I don't remember exactly what I did. I'll try to
give you hints, however.

ImportError: libwx_gtkd-2.4.so: cannot open shared object file: No such file
or directory

you've probably got it, but not in the right place. You can either
re-install differently, or you might be able to just copy or link it to
the right place..more later.

When I installed Python, I did not want to overwrite the existing
installation, so following the instructions, I installed the new one like
so -

    ./configure
    make
    make altinstall

This puts the new version of Python in /usr/local/bin and /usr/local/lib,
leaving the original version in /usr/bin and /usr/lib. This seems to have
worked ok.

You don't need to install python2.3 in /usr/local in order to preserve
2.2. Those two can co-exist jsut fine in /user. You may have other
reasons to use /usr/local, but this isn't one of them. The only problem
is what "python" ends up being...you can't have two /usr/bin/python
obviously, but you can have usr/bin/python2.2 and usr/bin/python2.3, and
have /usr/bin/python link to one of those. ON RedHat, it's probably best
to have it link the the original RedHat python, as their config tool use
it. I really wish they would just put:
#!/usr/bin/python2.2 as the #! line on all their tools, and then there
wouldn't be any problem. (Have they done this for RedHat9? I havn't
checked). Anyway, the python version problem is easily solved (on Unix
and OS-X anyway) by using a #! line like the above in all your own
scripts.

you can even link /usr/local/bin/python to /usr/bin/python2.,3 if you
want, but I wouldn't recomend it..then behaviour depends on $PATH order,
which seems fragile to me.

I installed wxPython from wxPythonGTK-py2.3-2.4.2.4-1.i386rpm. Before
installing it, I ran rpm with the -l option to see where it would put the
files. I could see some files going to /usr/bin, and others to /usr/lib.
After reading the rpm man pages, I decided to install wxPython with the
following options - --relocate /usr/bin=/usr/local/bin --relocate
/usr/lib=/usr/local/lib. This seemed to work ok.

That should work, but it doesn't seem to. At least it hasn';t for me. I
suspect that all the files got re-located, but there is a hard coded
path in there somewhere. I suspose that should either be fixed, or the
rpm marked as not being re-locatable (I have no idea how, but I think
that can be done.)

I thought that I would be able to run the original Python from /usr/bin, and
it would automatically import the original wxPython, and I would be able to
run the new Python from /usr/local/bin, and it would automatically import
the new wxPython. However, not only do I get the above error message from
the new Python, I also get a similar error message if I try to run the
original one - the file name in the error message is libwx_gtk2ud-2.4.so, as
the previous version was compiled for GTK2.

I had exactly the same problem, on REdHat 7.2, on 9, I just put it in
/usr, and it all worked better, but I don't have a 2.2 version running
there.

I can probably fix the old version by reinstalling everything from scratch,
but I would prefer to understand what I have done wrong and fix it
correctly.

YOu do need to re-install. I suspect that the so got clobered. YOu can
have both functional, I do on RedHat 7.s (the machine I'm on now), and I
don't think there is a difference between systems that should matter.
What I'd try is find libwx_gtkd-2.4.so, and move it around until you
have wx working with Python2.34. Then re-install wxPython for 2.2. As a
hint, here is what I have on my system, where I have 2.2 installed in
/usr, and 2.3 in /usr/local/:

/usr/lib/libwx_gtk-2.3.so.1.0.0
/usr/lib/libwx_gtk-2.3.so.1
/usr/lib/libwx_gtk_gl-2.3.so.1
/usr/lib/libwx_gtk_gl-2.3.a
/usr/lib/libwx_gtk_gl-2.3.so
/usr/lib/libwx_gtk_gl-2.3.so.1.0.0
/usr/lib/wxPython-2.4.2.4/lib/libwx_gtkd-2.4.so.0.1.1
/usr/lib/wxPython-2.4.2.4/lib/libwx_gtkd-2.4.so
/usr/lib/wxPython-2.4.2.4/lib/libwx_gtkd_gl-2.4.so.0.1.1
/usr/local/lib/wxPython/lib/libwx_gtkd-2.4.so.0.0.0
/usr/local/lib/wxPython/lib/libwx_gtkd-2.4.so.0
/usr/local/lib/wxPython/lib/libwx_gtkd-2.4.so
/usr/local/lib/wxPython/lib/libwx_gtkd_gl-2.4.so.0.0.0
/usr/local/lib/wxPython/lib/libwx_gtkd_gl-2.4.so.0
/usr/local/lib/wxPython/lib/libwx_gtkd_gl-2.4.so
/usr/local/lib/libwx_gtk-2.4.so.0.0.0
/usr/local/lib/libwx_gtk-2.4.so.0
/usr/local/lib/libwx_gtk-2.4.so

Note that I have both the "regular" wxGTK and the one that came with
wxPython installed. Also, a bunch of those are soft links, in the usual
*nix tradition. Maybe this will give you a hint

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

James Tauber wrote:

When recently testing, on Mac OS X, a wxPython application written mostly
on Windows, I encountered a problem whose root cause seems to be that the
tree control's OnEndEdit is being called twice.

I have confirmed that this happens in the wxPython demo too.

Is there a way to either:

  (1) prevent the second event from occurring; or
  (2) identify the second event as bogus so it can be ignored?

The only thing I can think of is a workaround where a flag is used to
ensure that an OnEndEdit without an OnBeginEdit is ignored.

That is probably the best way to do it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Frank Millman wrote:

Hi all,

I have upgraded Python and wxPython on my Redhat 9 system. Previous versions
are Python 2.2.3 and wxPython 2.4.0.2, new versions are Python 2.3.3c1 and
wxPython 2.4.2.4. Something has gone wrong.

If I go into the Python interpreter, and type "from wxPython.wx import *", I
get the following message -

ImportError: libwx_gtkd-2.4.so: cannot open shared object file: No such file
or directory

I will explain exactly what steps I have taken - hopefully someone can tell
me what I have done wrong.

When I installed Python, I did not want to overwrite the existing
installation, so following the instructions, I installed the new one like
so -

    ./configure
    make
    make altinstall

This puts the new version of Python in /usr/local/bin and /usr/local/lib,
leaving the original version in /usr/bin and /usr/lib. This seems to have
worked ok.

I installed wxPython from wxPythonGTK-py2.3-2.4.2.4-1.i386rpm. Before
installing it, I ran rpm with the -l option to see where it would put the
files. I could see some files going to /usr/bin, and others to /usr/lib.
After reading the rpm man pages, I decided to install wxPython with the
following options - --relocate /usr/bin=/usr/local/bin --relocate
/usr/lib=/usr/local/lib. This seemed to work ok.

I thought that I would be able to run the original Python from /usr/bin, and
it would automatically import the original wxPython, and I would be able to
run the new Python from /usr/local/bin, and it would automatically import
the new wxPython. However, not only do I get the above error message from
the new Python, I also get a similar error message if I try to run the
original one - the file name in the error message is libwx_gtk2ud-2.4.so, as
the previous version was compiled for GTK2.

I can probably fix the old version by reinstalling everything from scratch,
but I would prefer to understand what I have done wrong and fix it
correctly. Any information will be much appreciated.

The wxPython RPMs use a custom version of wxGTK(2) that is installed to a non-standard lib dir in order to not conflict with any wxGTK RPMs that are installed. Consequently the wxPython extension modules are linked with a rpath option so they can find their version of the wxGTK libs in that nonstandard location, which means that they will only be able to be found if located in the directory specified in the rpath. So as you've found, the wxPython RPMS are not able to be relocated. You will need to build your own versions of wxGTK and wxPython if you want them to be installed in different directories.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

James Tauber wrote:
> When recently testing, on Mac OS X, a wxPython application written mostly
> on Windows, I encountered a problem whose root cause seems to be that the
> tree control's OnEndEdit is being called twice.

[...]

> The only thing I can think of is a workaround where a flag is used to
> ensure that an OnEndEdit without an OnBeginEdit is ignored.

That is probably the best way to do it.

Cool - I'll go ahead and do that.

Does that mean it is a known issue with Mac OS X? Or is there some
reasonable justification for the event being called twice?

James

···

On Wed, 17 Dec 2003 10:42:18 -0800, "Robin Dunn" <robin@alldunn.com> said:
--
  James Tauber
  http://jtauber.com/

Robin Dunn wrote:

The wxPython RPMs use a custom version of wxGTK(2) that is installed to
a non-standard lib dir in order to not conflict with any wxGTK RPMs that
are installed. Consequently the wxPython extension modules are linked
with a rpath option so they can find their version of the wxGTK libs in
that nonstandard location, which means that they will only be able to be
found if located in the directory specified in the rpath. So as you've
found, the wxPython RPMS are not able to be relocated. You will need to
build your own versions of wxGTK and wxPython if you want them to be
installed in different directories.

Another kludgy option is to put a link in /usr to the lib (or just move
the lib). rather than moving you whole install.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

> You will need to
> build your own versions of wxGTK and wxPython if you want them to be
> installed in different directories.

You can also use chrpath (has to be downloaded) to strip the rpath
information out of the libraries. They then just need to be
in your $LD_LIBRARY_PATH (or similar).

Roger

Thanks to Chris, Robin, and Roger for your replies.

I tried the easiest solution, based on Robin's reply, and it worked :slight_smile:
This is what I did.

Robin explained that the path to gtk is hard-coded. I ran rpm -l to see
where it would have put libwx_gtkd-2.4.so, and found that it is supposed to
be in /usr/lib/wxPython-2.4.2.4/lib. Because of my relocate, it went to
/usr/local/lib/wxPython-2.4.2.4/lib. I simply moved the entire directory
/usr/local/lib/wxPython-2.4.2.4 to /usr/lib, and lo and behold, everything
worked.

Many thanks to all.

Frank