Confusing error: 'TextCtrl' object has no attribute 'StringSelection'

Hi All,

Some time ago, I wrote a custom HTML editor in wxpython on Windows XP.
I recently migrated to Ubuntu 9.04 and installed wxpython, but when I
try to run the application, I get the following error when I try to
execute any string functions:

AttributeError: 'TextCtrl' object has no attribute 'StringSelection'

Any suggestions?

Regards,
Ryan

Ryan wrote:

Hi All,

Some time ago, I wrote a custom HTML editor in wxpython on Windows XP.
I recently migrated to Ubuntu 9.04 and installed wxpython, but when I
try to run the application, I get the following error when I try to
execute any string functions:

AttributeError: 'TextCtrl' object has no attribute 'StringSelection'

Any suggestions?

Which version of wxPython is being used? TextCtrl.StringSelection is a property, but it didn't exist in wxPython 2.6. My guess is that is the version you are using instead of 2.8. See messages in the group archive and on the wiki for info on having more than one version installed and choosing between them at runtime.

···

--
Robin Dunn
Software Craftsman

Which version of wxPython is being used? TextCtrl.StringSelection is a
property, but it didn't exist in wxPython 2.6.

Thanks for pointing me in the right direction. The version I currently
have installed is 2.6.

Now I'm having a hell of a time trying to install wxPython2.8. I'm
following this website:

http://wiki.wxpython.org/InstallingOnUbuntuOrDebian

And when I get to this instruction:

sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n

It returns this error:

Unpacking replacement python-wxgtk2.8...
dpkg: error processing /var/cache/apt/archives/python-
wxgtk2.8_2.8.10.1-1_i386.deb (--unpack):
trying to overwrite '/usr/share/pyshared/wx-2.8-gtk2-unicode/
wxversion.py', which is also in package python-wxversion
Errors were encountered while processing:
/var/cache/apt/archives/python-wxgtk2.8_2.8.10.1-1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hi,

> Which version of wxPython is being used? TextCtrl.StringSelection is a
> property, but it didn't exist in wxPython 2.6.

Thanks for pointing me in the right direction. The version I currently
have installed is 2.6.

Now I'm having a hell of a time trying to install wxPython2.8. I'm
following this website:

InstallingOnUbuntuOrDebian - wxPyWiki

And when I get to this instruction:

sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n

It returns this error:

Unpacking replacement python-wxgtk2.8...
dpkg: error processing /var/cache/apt/archives/python-
wxgtk2.8_2.8.10.1-1_i386.deb (--unpack):
trying to overwrite '/usr/share/pyshared/wx-2.8-gtk2-unicode/
wxversion.py', which is also in package python-wxversion
Errors were encountered while processing:
/var/cache/apt/archives/python-wxgtk2.8_2.8.10.1-1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I am not a linux guru, but I have installed 2.8 on Ubuntu using the
GUI version of the package manager. I used the curl command on the
wiki to add the repository and then did a search for wx using the GUI.
It found the new one and I just told it to install it and away it
went.

I haven't had any problems...but I didn't try the command-line way
that is listed either.

- Mike

···

On Jun 25, 11:25 pm, Ryan <edi...@raisethehammer.org> wrote:

Ryan wrote:

Which version of wxPython is being used? TextCtrl.StringSelection is a
property, but it didn't exist in wxPython 2.6.

Thanks for pointing me in the right direction. The version I currently
have installed is 2.6.

Now I'm having a hell of a time trying to install wxPython2.8. I'm
following this website:

InstallingOnUbuntuOrDebian - wxPyWiki

And when I get to this instruction:

sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n

It returns this error:

Unpacking replacement python-wxgtk2.8...
dpkg: error processing /var/cache/apt/archives/python-
wxgtk2.8_2.8.10.1-1_i386.deb (--unpack):
trying to overwrite '/usr/share/pyshared/wx-2.8-gtk2-unicode/
wxversion.py', which is also in package python-wxversion
Errors were encountered while processing:
/var/cache/apt/archives/python-wxgtk2.8_2.8.10.1-1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

There is indeed a duplicate file between those packages, although I was somehow able to get them installed on my 9.04 machine... I'll try to get a new set of packages made soon. In the meantime you can try using the force options to make apt ignore the error, or perhaps Synaptic will work around it in some way. (That's probably what I used when I installed on my system.)

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

There is indeed a duplicate file between those packages, although I was somehow able to get them installed on my 9.04 machine... I'll try to get a new set of packages made soon. In the meantime you can try using the force options to make apt ignore the error, or perhaps Synaptic will work around it in some way. (That's probably what I used when I installed on my system.)

Hi Robin,

Thanks again for your help. I managed to get it installed using easy_install (I didn't know you could do it that way). Now I'm playing around with wxversion.py to get the right version loaded with my wxPython app.

Kind Regards,
Ryan