yuce / pyswip

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
MIT License
465 stars 96 forks source link

Compat8.2.0 #93

Closed allComputableThings closed 4 years ago

allComputableThings commented 4 years ago

PL_STRING has changed in SWI-Prolog.h.

allComputableThings commented 4 years ago

Added check for required PL_version.

allComputableThings commented 4 years ago

Now with compatibility for 7.x.x to 8.3.x

yuce commented 4 years ago

Tests don't pass on 7.6.3 since PL_version doesn't seem to exist in that version:

tests/test_examples.py:31: in <module>
    from pyswip import *
pyswip/__init__.py:29: in <module>
    from pyswip.prolog import Prolog
pyswip/prolog.py:28: in <module>
    from pyswip.core import *
pyswip/core.py:576: in <module>
    PL_version = _lib.PL_version
/usr/lib/python3.6/ctypes/__init__.py:361: in __getattr__
    func = self.__getitem__(name)
/usr/lib/python3.6/ctypes/__init__.py:366: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/lib/libswipl.so.7.6: undefined symbol: PL_version

Maybe setting PL_version to something like 70000 if _lib.PL_version does not exist would work better.

allComputableThings commented 4 years ago

Sounds good. Will do it tomorrow

On Thu, Jun 18, 2020 at 10:04 PM Yüce Tekol notifications@github.com wrote:

Tests don't pass on 7.6.3 since PL_version doesn't seem to exist in that version:

tests/test_examples.py:31: in from pyswip import pyswip/init.py:29: in from pyswip.prolog import Prolog pyswip/prolog.py:28: in from pyswip.core import pyswip/core.py:576: in PL_version = _lib.PL_version /usr/lib/python3.6/ctypes/init.py:361: in getattr func = self.getitem(name) /usr/lib/python3.6/ctypes/init.py:366: in getitem func = self._FuncPtr((name_or_ordinal, self)) E AttributeError: /usr/lib/libswipl.so.7.6: undefined symbol: PL_version

Maybe setting PL_version to something like 70000 if _lib.PL_version does not exist would work better.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yuce/pyswip/pull/93#issuecomment-646436799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3QJLHPNLWM45OZZMS2ATTRXLWXTANCNFSM4OCEPXWA .

allComputableThings commented 4 years ago

It is done. By the way, does the test fail in the continuous integration somewhere? I didn't see the error you reported? (All I see is https://github.com/yuce/pyswip/pull/93 , which said all tests pass).

On Thu, Jun 18, 2020 at 11:30 PM Stuart Reynolds stuart@stuartreynolds.net wrote:

Sounds good. Will do it tomorrow

On Thu, Jun 18, 2020 at 10:04 PM Yüce Tekol notifications@github.com wrote:

Tests don't pass on 7.6.3 since PL_version doesn't seem to exist in that version:

tests/test_examples.py:31: in from pyswip import pyswip/init.py:29: in from pyswip.prolog import Prolog pyswip/prolog.py:28: in from pyswip.core import pyswip/core.py:576: in PL_version = _lib.PL_version /usr/lib/python3.6/ctypes/init.py:361: in getattr func = self.getitem(name) /usr/lib/python3.6/ctypes/init.py:366: in getitem func = self._FuncPtr((name_or_ordinal, self)) E AttributeError: /usr/lib/libswipl.so.7.6: undefined symbol: PL_version

Maybe setting PL_version to something like 70000 if _lib.PL_version does not exist would work better.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yuce/pyswip/pull/93#issuecomment-646436799, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3QJLHPNLWM45OZZMS2ATTRXLWXTANCNFSM4OCEPXWA .

yuce commented 4 years ago

Not sure why the CI report doesn't show up... Thanks for the PR, tests pass on local.

ramparany commented 1 year ago

Hi, This issue seems to pop up again : This python script fails with the same error (/build/swi-prolog-hvyroz/swi-prolog-9.0.0-1-g0757fd884/src/pl-fli.c:2637: PL_put_chars: Assertion failed: 0): from pyswip import Prolog prolog = Prolog() prolog.assertz("father(joe,john)") Did somebody face the same issue, and do you know how to solve the problem?

Thank you in advance for your help :)

Here are the versions of my environment: Ubuntu 20.04.5 LTS pyswip: 0.2.10 swi-prolog: 9.0.0 for x86_64-linux