Python problem with upgrade from 19.10 to 20.04

Chris Green cl at isbd.net
Fri Jul 24 14:07:18 UTC 2020


On Fri, Jul 24, 2020 at 12:49:06PM +0100, Colin Watson wrote:
> On Thu, Jul 23, 2020 at 09:55:35PM +0100, Chris Green wrote:
> > I have recently upgraded my desktop system from ubuntu 19.10 to ubuntu
> > 20.04.  I have some Oki printer/scanner driver software that is
> > written in Python 2 and, although python 2 is still installed on my
> > system it's no longer the default python and the Oki software no
> > longer runs.
> > 
> > The error I am getting is:-
> > 
> >     chris at esprimo$ ./scantool.py
> >     Traceback (most recent call last):
> >       File "./scantool.py", line 52, in <module>
> >         import gtk
> >     ImportError: No module named gtk
> > 
> > So what do I need to install on my Ubuntu 20.04 system to provide the
> > gtk module?
> 
> That used to be python-gtk2, but it's probably unreasonably hard to
> install it on Ubuntu 20.04, unless you can find a PPA that you trust
> and that provides it.
> 
> Have you tried asking your software vendor for an updated program?  It
> sounds like this program was written for Python 2 (which has been
> clearly on the way out for some years, and is officially end-of-life as
> of the start of this year), and also for GTK+ 2 (last full release
> 2011-01-30; last maintenance patch 2018-01-08).  Ubuntu provided both
> stacks for a very long overlap time, and they should have had time to
> come up with something a little more current by now.
> 
I am trying to get the 'software vendor' to update but I don't hold
out much hope.  It's scanner software for an OKI all-in-one printer,
scanner, copier, FAX machine.  I was really quite surprised that it
came with Linux software at all.  I have been using it successfully
for a few years.  As I say I have asked them though and maybe they'll
come up with the goods.


> > Alternatively (but much harder work) what is the Python 3 equivalent
> > of the the Python 2 pygtk and gtk modules.
> 
> The old-style PyGTK bindings were never ported to Python 3; the modern
> approach is to use the gobject-introspection-based bindings, using
> python3-gi and gir1.2-gtk-3.0.  (I believe the impetus for moving to
> these is that the bindings could be maintained with much less manual
> effort; and by "modern" I mean that I have a child learning to program
> who's younger than them.)
> 
> This GNOME wiki page may help, and if the script is small enough and you
> have a bit of familiarity with Python then you may be able to do the
> port fairly mechanically:
> 
> https://wiki.gnome.org/Projects/PyGObject/IntrospectionPorting#Porting_from_PyGTK_2_to_PyGI_GTK_3 
> 
Thank you, that might help me, I can program Python *reasonably* well.
There's something over 6000 lines of code involved though so a fair
amount to deal with.  It's obviously not all GUI though so not as bad
as it might seem at first.  I need to get my housekeeping in order
first though and import it all into mercurial to manage it.

-- 
Chris Green




More information about the ubuntu-users mailing list