Re: How to diagnose import error when importing from .so file?
Am 29.07.20 um 23:01 schrieb Chris Green: Even more annoying is that most of what's in pyscand.so is constants, there's only a couple of functions in there, so there's very little to it really. If there are really only constants, you could import it into Python 2 and dump the content e.g. as a JSON file to read it in under Python 3. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: How to diagnose import error when importing from .so file?
Christian Heimes wrote: > On 29/07/2020 15.34, Chris Green wrote: > > I have some Python Gtk 2 code I'm trying to convert to Python > > pygobject GTK 3. > > > > However I'm stuck on an import statement that fails:- > > > > import pyscand > > > > > > The error message is:- > > > > File "/usr/libexec/okimfputl.new/guicom.py", line 66, in > > import pyscand > > ImportError: /usr/libexec/okimfpdrv/pyscand.so: undefined symbol: > > _Py_ZeroStruct > > > > pyscand is a .so file so I fear I may be a bit stuffed unless I can > > find the source code for it. However any other ideas would be most > > welcome. > > > > In fact looking for this error it seems that is is a Python version > > mismatch error and I need to recompile pyscand.so against Python 3. Is > > there no way to sort of convert it to Python 3 without having the > > source? > > You are right. The extension module is compiled for Python 2. > _Py_ZeroStruct is only available in Python 2. You need the C code for > the extension module. and possibly even modify the C code to make the > extension work with Python 3. > Thanks for confirming, though it's not good news really as the chances of getting the C code to recompile pyscand.so are minimal. It's a piece of code provided by OKI and I don't really think I'll be able to get the code out of them. Even more annoying is that most of what's in pyscand.so is constants, there's only a couple of functions in there, so there's very little to it really. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list
Re: How to diagnose import error when importing from .so file?
On 29/07/2020 15.34, Chris Green wrote: > I have some Python Gtk 2 code I'm trying to convert to Python > pygobject GTK 3. > > However I'm stuck on an import statement that fails:- > > import pyscand > > > The error message is:- > > File "/usr/libexec/okimfputl.new/guicom.py", line 66, in > import pyscand > ImportError: /usr/libexec/okimfpdrv/pyscand.so: undefined symbol: > _Py_ZeroStruct > > pyscand is a .so file so I fear I may be a bit stuffed unless I can > find the source code for it. However any other ideas would be most > welcome. > > In fact looking for this error it seems that is is a Python version > mismatch error and I need to recompile pyscand.so against Python 3. Is > there no way to sort of convert it to Python 3 without having the > source? You are right. The extension module is compiled for Python 2. _Py_ZeroStruct is only available in Python 2. You need the C code for the extension module. and possibly even modify the C code to make the extension work with Python 3. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: How to diagnose import error when importing from .so file?
> pyscand is a .so file so I fear I may be a bit stuffed unless I can > find the source code for it. > ... > In fact looking for this error it seems that is is a Python version > mismatch error and I need to recompile pyscand.so against Python 3. Is > there no way to sort of convert it to Python 3 without having the > source? Unfortunately, you'll need to recompile the .so file (or replace the dependency). Good luck! - DLD -- David Lowry-Duda -- https://mail.python.org/mailman/listinfo/python-list