openzim / python-libzim

Libzim binding for Python: read/write ZIM files in Python
https://pypi.org/project/libzim/
GNU General Public License v3.0
62 stars 19 forks source link

Error 'class zim::search_iterator' has no member named 'get_url' when building with freshly built libzim. #105

Closed IMayBeABitShy closed 3 years ago

IMayBeABitShy commented 3 years ago

Hello,

I attempted to build python-libzim using py3.8. Using a freshly build libzim, I encountered the following error message:

running build_ext
building 'libzim.wrapper' extension
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Ilibzim -I./libzim -Iinclude -I/usr/local/include/python3.8 -c libzim/wrapper.cpp -o build/temp.linux-x86_64-3.8/libzim/wrapper.o -std=c++11 -Wall -Wextra
libzim/wrapper.cpp: In function 'PyObject* __pyx_gb_6libzim_7wrapper_9PyArchive_22generator(__pyx_CoroutineObject*, PyThreadState*, PyObject*)':
libzim/wrapper.cpp:11286:69: error: 'class zim::search_iterator' has no member named 'get_url'
11286 | x_t_1 = __Pyx_decode_cpp_string(__pyx_cur_scope->__pyx_v_it.get_url(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 630, __pyx_L1_error)
      |                                                             ^~~~~~~

libzim/wrapper.cpp: In function 'PyObject* __pyx_gb_6libzim_7wrapper_9PyArchive_25generator1(__pyx_CoroutineObject*, PyThreadState*, PyObject*)':
libzim/wrapper.cpp:11573:69: error: 'class zim::search_iterator' has no member named 'get_url'
11573 | x_t_1 = __Pyx_decode_cpp_string(__pyx_cur_scope->__pyx_v_it.get_url(), 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error)
      |                                                             ^~~~~~~

error: command 'gcc' failed with exit status 1

After some debugging, I believe the culprit to be this commit made eleven days ago on the libzim repository. Said commit replaces get_url() with get_path().

However, my experience with cython is exactly 0 and my c/c++ experience is also not great, so there is a high chance that I'm wrong.

Also, would it be possible to publish a new version to pypi? It seems like the API has changed quite a bit and it would be nice to install the new version directly from pypi.

Update: I changed all occurences of get_url() to get_path() and python-libzim now compiles correctly.

kelson42 commented 3 years ago

@IMayBeABitShy Thank you for your bug report and patch, this is indeed a regression introduced recently in the dev branch. Your PR will be reviewed shortly.