Seg fault when runnning a query in a Thread

44 views
Skip to first unread message

jpalanca

unread,
Oct 26, 2009, 5:56:47 AM10/26/09
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

Sandeep

unread,
Oct 27, 2009, 7:16:10 AM10/27/09
to pyswip
I also get segmentation fault on Linux 64 bit.

Javi, are you using 32 bit version? If not can someone test it on 32
bit and post the result.?

- Sandeep

jpalanca

unread,
Oct 27, 2009, 7:28:05 AM10/27/09
to pyswip
I'm using Snow Leopard with Core2Duo. 64 bit

Javi
Reply all
Reply to author
Forward
0 new messages