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

Chris Green cl at isbd.net
Thu Dec 17 04:58:24 EST 2020


Cameron Simpson <cs at cskk.id.au> wrote:
> >> 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...)
> 
Try running scantool.py, that should pop up a little GUI.

It uses GTK which of course in itself makes migration tricky because
one has to move from the native Python 2 code to the 'introspection'
code on Python 3.  However I can do those code changes, the killer is
that several of the scripts import pyscand and that's the Python 2
library.

The issue basically is that you can't run Python 2 GTK in a modern
system that's mostly Python 3 because the GTK libraries conflict. Thus
I need to convert the code to Python 3 but I can't because of the
library.

I've extracted all the calls/uses of pyscand from the Python code:-

    pyscand.ADF:
    pyscand.BEGIN:
    pyscand.EVENT_PUSHSCAN:
    pyscand.EVENT_PUSHSCANCCL:
    pyscand.E_BUSY
    pyscand.E_BUSY:
    pyscand.E_CANCELED:
    pyscand.E_CONNECTION_REFUSED:
    pyscand.E_ERROR
    pyscand.E_IOERROR:
    pyscand.E_NODATA:
    pyscand.E_SUCCESS
    pyscand.E_SUCCESS:
    pyscand.FINISHED:
    pyscand.O_HEIGHT
    pyscand.O_PAPER_HEIGHT
    pyscand.O_PAPER_WIDTH
    pyscand.O_WIDTH
    pyscand.PRM_ACTION
    pyscand.PRM_DEVICE
    pyscand.PRM_DEVICE
    pyscand.PRM_PAGE
    pyscand.PRM_PATH
    pyscand.PRM_PROGRESS
    pyscand.PRM_PUSHSCAN_ID
    pyscand.PRM_SOURCE
    pyscand.PRM_STATUS
    pyscand.PROGRESS:
    pyscand.TO_APPLICATION:
    pyscand.TO_FOLDER:
    pyscand.cancel_register_client()
    pyscand.cancel_scan(device)
    pyscand.exit_client()
    pyscand.get_device_list(devicelist)
    pyscand.is_registered()
    pyscand.recv_client_event()
    pyscand.register_client()
    pyscand.scan(self._device, self._cfg, outpath, self._scan_callback,
    self._pushscanid)
    pyscand.strstatus(rc)))
    pyscand.strstatus(status)
    pyscandsupp.to_device_name_list(devicelist)

As you can see it's mostly constants but there's that pyscand.scan()
at the bottom which I suspect is the fundamental scanning software.

-- 
Chris Green
·


More information about the Python-list mailing list