jpalanca
unread,Oct 26, 2009, 5:56:47 AM10/26/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pyswip
Hi.
I'm having some problems when using pyswip with threads. Running a
query in a thread results in a Segmentation fault of the python
interpreter, but running the SAME code out of a thread does work fine.
A simple example:
from pyswip import Prolog
kb0 = Prolog()
kb0.assertz("father(john,paul)")
for child in list(kb0.query("father(john,X)")):
print child
works fine. But embedding the same code in a thread launches the
segmentation fault when running the query:
from pyswip import Prolog
from threading import *
class H(Thread):
def run(self):
kb0 = Prolog()
kb0.assertz("father(john,paul)")
for child in list(kb0.query("father(john,X)")):
print child
h = H()
h.start()
h.join()
Segmentation fault ("Bus error" on Mac OSX)
Can you help me?
Thanks.
Javi Palanca