"Error en el bus" from python

Philip Semanchuk philip at semanchuk.com
Sun Oct 11 22:47:56 EDT 2009


On Oct 11, 2009, at 4:45 PM, Yusniel wrote:

> Hi. I did installed a library for python named pyswip-0.2.2 but when I
> run a python example with the next lines, the python interpreter, it
> throw me the following error: "Error en el bus". The code lines are:
>
> from pyswip.prolog import Prolog
> from pyswip.easy import getList, registerForeign
>
> N = 3  # Number of disks
>
> def main():
>    def notify(t):
>        print "move disk from %s pole to %s pole." % tuple(t)
>    notify.arity = 1
>
>    prolog = Prolog()
>    registerForeign(notify)
>    prolog.consult("hanoi.pl")
>    list(prolog.query("hanoi(%d)" % N))
>
> if __name__ == "__main__":
>    main()
>
> where "hanoy.pl" is a program with python code. Any solution for this
> error?. Thanks.

Are you on a Mac by any chance? I get a "bus error" out of Python once  
in a while, usually when a C library has done something bad. I don't  
know if this error is specific to OS X or not.

The first thing you need to do is comment out lines one by one to see  
where the problem occurs. I'd start by commenting out all four calls  
to the pyswip.prolog library:

#   prolog = Prolog()
#   registerForeign(notify)
#   prolog.consult("hanoi.pl")
#   list(prolog.query("hanoi(%d)" % N))

If the bus error no longer occurs, then you know the problem is in the  
pyswip.prolog library. With that knowledge, I'd move to the mailing  
list or newsgroup for pyswip.

Hope that helps
Philip







More information about the Python-list mailing list