[erfolglos] kaa-imlib2 unter Python 3
-
kle -
19. November 2018 um 16:16 -
Erledigt
-
-
[erfolglos] kaa-imlib2 unter Python 3? Schau mal ob du hier fündig wirst!
-
Hi Linus ,
den Traceback aus #20, Edit_2 habe ich so gelöst:
Code: ~/kaa-imlib2/src/imlib2.c/* c_api = PyCObject_FromVoidPtr((void *)api_ptrs, NULL); */ c_api = PyCapsule_New((void *)api_ptrs, NULL, NULL); /* kle 28.11.2018 */
aber damit die Arbeit nicht ausgeht:
Traceback: undefined symbol: Py_FindMethod
pi@raspberrypi5:/usr/local/lib/newtron-v2 $ Traceback (most recent call last):
File "newtron-radio-v2.7.5-mig.py", line 11, in <module> from kaa import imlib2
File "/usr/local/lib/python3.5/dist-packages/kaa/imlib2/__init__.py", line 35, in <module> from .image import *
File "/usr/local/lib/python3.5/dist-packages/kaa/imlib2/image.py", line 46, in <module> from . import _Imlib2module as _Imlib2
ImportError: /usr/local/lib/python3.5/dist-packages/kaa/imlib2/_Imlib2module.cpy thon-35m-arm-linux-gnueabihf.so: undefined symbol: Py_FindMethod
[1]+ Exit 1 sudo python3 newtron-radio-v2.7.5-mig.py
es geht um Zeile 121:
Code: ~/kaa-imlib2/src/font.c
Alles anzeigenPyObject *Font_PyObject__getattr(Font_PyObject *self, char *name) { int value, found = 1; PyImlib2_BEGIN_CRITICAL_SECTION imlib_context_set_font(self->font); if (!strcmp(name, "descent")) value = imlib_get_font_descent(); else if (!strcmp(name, "ascent")) value = imlib_get_font_ascent(); else if (!strcmp(name, "max_ascent")) value = imlib_get_maximum_font_ascent(); else if (!strcmp(name, "max_descent")) value = imlib_get_maximum_font_descent(); else found = 0; PyImlib2_END_CRITICAL_SECTION if (found) return Py_BuildValue("i", value); return Py_FindMethod(Font_PyObject_methods, (PyObject *)self, name); }
Fehlt da ein Include?
Schönen Gruß, kle
-
-
Hi Linus
Py_FindMethod ist gefixt.
Fix Py_InitModule
~/kaa-imlib2/src/imlib2.c:351: undefined symbol: Py_InitModule
PyModuleDef moduledef; /* kle 28.11.2018 */
.../* m = Py_InitModule("_Imlib2", Imlib2_methods); */
#if PY_MAJOR_VERSION >= 3
m = PyModule_Create(&moduledef);
#else
m = Py_InitModule("_Imlib2", Imlib2_methods);
#endif
Traceback: undefined symbol: PyBuffer_FromObject
pi@raspberrypi5:/usr/local/lib/newtron-v2 $ Traceback (most recent call last):
File "newtron-radio-v2.7.5-mig.py", line 11, in <module>
from kaa import imlib2
File "/usr/local/lib/python3.5/dist-packages/kaa/imlib2/__init__.py", line 35, in <module>
from .image import *
File "/usr/local/lib/python3.5/dist-packages/kaa/imlib2/image.py", line 46, in <module>
from . import _Imlib2module as _Imlib2
ImportError: /usr/local/lib/python3.5/dist-packages/kaa/imlib2/_Imlib2module.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: PyBuffer_FromObject
[1]+ Exit 1 sudo python3 newtron-radio-v2.7.5-mig.py
es geht um Zeile 693:
Code: ~/kaa-imlib2/src/image.c
Alles anzeigenPyObject *Image_PyObject__get_raw_data(PyObject *self, PyObject *args) { char *format; int write; Py_ssize_t len; Image_PyObject *o = (Image_PyObject *)self; int Py_END_OF_BUFFER; /* Egg 26.11.2018 */ if (!PyArg_ParseTuple(args, "si", &format, &write)) return NULL; if (!strcmp(format, "BGRA")) { // Requested native format, so create a buffer directly from the // Image pyobject. if (write) return PyBuffer_FromReadWriteObject(self, 0, Py_END_OF_BUFFER); else return PyBuffer_FromObject(self, 0, Py_END_OF_BUFFER);
heißt das jetzt, daß ich
- die Old-style buffer objects ersetzen muß durch
- die The new-style Py_buffer struct
weil PyBuffer_FromObject in Python3 fehlt?
Schönen Gruß, kle
-
heißt das jetzt, daß ich
die Old-style buffer objects ersetzen muß durch
die The new-style Py_buffer structweil PyBuffer_FromObject in Python3 fehlt?
Richtig - nur muss mir an dieser Stelle ein C-Profi helfen, aus der Doku (https://docs.python.org/3.7/c-api/buffer.html) werde ich nicht wirklich schlauer, was nun konkret zu ersetzen ist.
-
Hi Linus ,
hilft Dir dieser Link
es sollen zwar 50 Beispiele sein, ich vermute es ist 50x der selbe Code.
Edit: und dieser Link (fedora workaround für PyObject_AsReadBuffer)
Zum Thema new-Style Python Buffer:
wenn ich das richtig sehe, beschäftigen sich 3 Funktionen mit dem Buffer:
- imlib2_open_from_memory (~/kaa-imlib2/src/imlib2.c:191:)
- PyArg_ParseTuple
- PyObject_AsReadBuffer
- Image_PyObject__get_raw_data (~/kaa-imlib2/src/image.c:675:)
- PyArg_ParseTuple
- PyBuffer_FromReadWriteObject
- PyBuffer_FromObject
- imlib_context_set_image
- get_raw_bytes_size
- PyBuffer_New
- PyObject_AsWriteBuffer
- get_raw_bytes
- Image_PyObject__put_back_raw_data (~/kaa-imlib2/src/image.c:717:)
- PyArg_ParseTuple
- PyObject_AsWriteBuffer
- imlib_context_set_image
- imlib_image_put_back_data
Schönen Gruß, kle
- imlib2_open_from_memory (~/kaa-imlib2/src/imlib2.c:191:)
-
Jetzt mitmachen!
Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!