Python 2 to Python 3 .so library incompatibility - need help

Michał Jaworski swistakm at gmail.com
Thu Dec 17 04:51:50 EST 2020


I've looked into the details of the deb package that Cameron mentioned. It
may be the one that you Chris uss because it does indeed include a
pyscand.so file. Quick question to you Chris: the utilities
you've mentioned are the code that you've written yourself or utilities
from /usr/libexec/okimfputl that are shipped with the "driver package". In
the deb package I've found following files:
/usr/libexec/okimfputl/imgfilecv.py
/usr/libexec/okimfputl/pushconfig.py
/usr/libexec/okimfputl/pushass.py
/usr/libexec/okimfputl/mfpcfgfile.py
...

If that's the latter, I wouldn't even try to port that to Python 3. First,
it would be clearly against the licence agreement. Second, that would
probably result in total mess and take more time that it takes to earn for
a new printer. If you really want to keep the printer (I wouldn't) I would
do the following: upgrade your system, install Python 2.7 straight from
sources in a separate location (e.g. /opt/oki-python?) and modify all
shebang lines of the OKI python utilities from utilities to use that python
location instead of "/usr/bin/env python" or "/usr/bin/python". That would
make it totally independent of your system installation. The last thing
would be probably installing pygtk in that "isolated" python installation
as OKI utilities clearly rely on this. You could use venv for that or just
simply make sure that gtk for python2 is in that python's library path.
Whatever more convenient: you won't be using that python installation for
anything else than supporting the driver.

To be honest, what I would really do is to buy a new printer from a vendor
that is known to be supporting their hardware for long term on the system
you use. Printer vendors sucks. In the end, they always stop producing
printing supplies you need and render your hardware useless. I have a combo
that I can't refill with toner anymore which has used photoconductor drum
that I can't replace anymore. I keep it around because it has a working
scanner and haven't buyed a new printer because this one "almost works".

Cheers,
Michał

śr., 16 gru 2020 o 23:48 Cameron Simpson <cs at cskk.id.au> napisał(a):

> On 16Dec2020 21:59, Chris Green <cl at isbd.net> wrote:
> >Cameron Simpson <cs at cskk.id.au> wrote:
> >> On 16Dec2020 18:51, Chris Green <cl at isbd.net> wrote:
> >> >The specific problem that finally prevented me from managing to get it
> >> >to work was a (Linux) .so file that had been built for Python 2 and,
> >> >as I don't have the source, I can't build for Python 3.
> >>
> >> ChrisA I think suggested keeping a Python 2.7 install around for this.
> >>
> >Not possible really as there are other python conflicts that start
> >appearing if one tries to retain the libraries needed.
>
> Runtime python issues like you missing symbol error, or package conflict
> issues?
>
> i.e. can you keep the OKI stuff sitting around along with Python 2
> install without having trouble with the PPA?
>
> >> >I need to have another go at fixing this as otherwise the code that
> >> >I need to manage my printer will stop working as I update my Ubuntu
> >> >systems.
>
> I'm leaning towards ChrisA's JSON suggestion at this point (absent newer
> driver software). Keep a small Python 2 programme around which uses the
> printer driver in whatever _basic_ ways you need, and _invoke that_ from
> your modern Python 3 code as an external command, passing/receiving the
> necessary information in JSON form as input.output, or on its command
> line if that is more convenient.
>
> >> Have you considered keeping a legacy VM around as well? I have a few VMs
> >> sitting here I use for some legacy software.
> >>
> >That's not a lot of use.  The programs that I want to run (by
> >converting to Python 3) are utility programs for my printer, they
> >install with a handy 'app' in my toolbar.  Having them in a VM
> >wouldn't really do much good! :-)
>
> Fair enough. It seemed cumbersome to me too, but it is a viable way to
> keep something legacy around, particularly if that legacy thing requires
> a legacy OS.
>
> >I still have python 2.  The issue is that the programs need modules
> >which come from a PPA to support Python GTK, these conflict with
> >ongoing updates to Python.  The PPA works OK in Ubuntu 20.04 but
> >prevents some updates in 20.10.  I expect it will get worse as time
> >goes on.
> [...]
> >> Guessing from the library name, have you looked on the OKI.com site
> >> for current software? Maybe here? What's your printer model?
> >>
> https://www.oki.com/au/printing/support/drivers-and-utilities/index.html
> >>
> >>
> >It comes from OKI with the Linux utilities for the printer, it's an
> >MC342N.
>
> From here?
>
>
> https://www.oki.com/uk/printing/support/drivers-and-utilities/colour-multifunction/01331401/?os=ab33&lang=ac2
>
> This driver?
>
>
> https://www.oki.com/uk/printing/support/drivers-and-utilities/?id=46252701FZ01&tab=drivers-and-utilities&productCategory=colour-multifunction&sku=01331401&os=ab33&lang=ac2
>
> I've just installed the .deb above on my Ubuntu 20.04.1 LTS system.
> Aside from whinging about systemd it installed ok. How do I reproduce
> your problems? (I've got no printer of course, but...)
>
> >I have tried asking them for a Python 3 version, maybe I should try
> >again.
>
> Can't hurt, but may not be necessary if you are prepared to split your
> Python 3 code form the Python 2 stuff that ships with the .deb.
>
> Cheers,
> Cameron Simpson <cs at cskk.id.au>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list