FAQ
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.

Search Discussions

  • Steven D'Aprano at Oct 11, 2009 at 10:29 pm

    On Sun, 11 Oct 2009 13:45:54 -0700, 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". ...
    where "hanoy.pl" is a program with python code. Any solution for this
    error?. Thanks.
    Please post the entire traceback.


    --
    Steven
  • Yusniel at Oct 12, 2009 at 2:27 am

    On 11 oct, 18:29, Steven D'Aprano <st... at REMOVE-THIS- cybersource.com.au> wrote:
    On Sun, 11 Oct 2009 13:45:54 -0700, 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". ...
    where "hanoy.pl" is a program with python code. Any solution for this
    error?. Thanks.
    Please post the entire traceback.

    --
    Steven
    Steven. Thanks for your answer. In this case, I am running the script
    in a terminal and the error is: "Error en el bus" only this, not more.
    Any idea?.
  • Philip Semanchuk at Oct 12, 2009 at 2:47 am

    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
  • Philip Semanchuk at Oct 12, 2009 at 4:08 am

    On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote:

    On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel <yhidalgo86 at gmail.com
    declaimed the following in gmane.comp.python.general:

    prolog.consult("hanoi.pl") <snip>
    where "hanoy.pl" is a program with python code. Any solution for this
    error?. Thanks.
    Are you sure? .pl is a common extension for PERL programs, not
    Python.
    My guess is that it is also a common extension for Prolog programs. I
    think the OP's "program with python code" should have been "program
    with prolog code".
  • Yusniel at Oct 12, 2009 at 3:27 pm

    On 12 oct, 00:08, Philip Semanchuk wrote:
    On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote:

    On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel <yhidalg... at gmail.com
    declaimed the following in gmane.comp.python.general:
    ? ?prolog.consult("hanoi.pl") ? ?<snip>
    where "hanoy.pl" is a program with python code. Any solution for this
    error?. Thanks.
    ? ?Are you sure? .pl is a common extension for PERL programs, not
    Python.
    My guess is that it is also a common extension for Prolog programs. I ?
    think the OP's "program with python code" should have been "program ?
    with prolog code".
    Exactly. "hanoi.pl" is a prolog program. I'm using Ubuntu(9.04) 32
    bit. In this case, this error is generated when I try run the above
    script. However, others scripts in python, not throws this error, I
    think that there are some problem with this library.
  • Philip Semanchuk at Oct 12, 2009 at 3:36 pm

    On Oct 12, 2009, at 11:27 AM, Yusniel wrote:
    On 12 oct, 00:08, Philip Semanchuk wrote:
    On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote:

    On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel
    <yhidalg... at gmail.com
    declaimed the following in gmane.comp.python.general:
    prolog.consult("hanoi.pl") <snip>
    where "hanoy.pl" is a program with python code. Any solution for
    this
    error?. Thanks.
    Are you sure? .pl is a common extension for PERL programs, not
    Python.
    My guess is that it is also a common extension for Prolog programs. I
    think the OP's "program with python code" should have been "program
    with prolog code".
    Exactly. "hanoi.pl" is a prolog program. I'm using Ubuntu(9.04) 32
    bit. In this case, this error is generated when I try run the above
    script. However, others scripts in python, not throws this error, I
    think that there are some problem with this library.

    Sounds like it's time to talk to whoever supports the Prolog library,
    then.

    Good luck
    Philip
  • Carsten Haese at Oct 12, 2009 at 3:40 pm

    Yusniel wrote:
    Exactly. "hanoi.pl" is a prolog program. I'm using Ubuntu(9.04) 32
    bit. In this case, this error is generated when I try run the above
    script. However, others scripts in python, not throws this error, I
    think that there are some problem with this library.
    Maybe, but it's impossible to tell what exactly the problem is if you
    don't show us your code. hanoi.pl is part of your code, but you haven't
    posted it. Please post it.
  • Jorgen Grahn at Oct 12, 2009 at 8:23 pm

    On Mon, 2009-10-12, Philip Semanchuk wrote:
    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:
    Makes me think of that guy from the Simpsons, in the bumble-bee suit ...
    fortunately you don't need to know tech Spanish to decode this one.

    ...
    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.
    "Bus Error" is an old BSD-ism which I guess you don't see much in
    Linux or Solaris these days (or maybe I never run buggy code ;-). It
    translates roughly to "segmentation fault", but IIRC it is more about
    accessing memory words on nonaligned adresses than about accessing
    addresses your process doesn't own.

    [...]

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
  • Greg at Oct 12, 2009 at 11:46 pm

    Jorgen Grahn wrote:

    "Bus Error" is an old BSD-ism which I guess you don't see much in
    Linux or Solaris these days (or maybe I never run buggy code ;-). It
    translates roughly to "segmentation fault", but IIRC it is more about
    accessing memory words on nonaligned adresses than about accessing
    addresses your process doesn't own.
    I think the term goes back to the PDP-11 or thereabouts. The
    Unibus used a handshaking protocol, and if you tried to access
    an address that didn't have any memory or I/O device assigned
    to it, the bus hardware would time out and you got an interrupt.

    The 68K family also used the term in a similar way.

    I think the distinction between a bus error and a seg fault is
    that bus errors are to do with physical addresses, and seg
    faults are to do with virtual addresses.

    --
    Greg

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedOct 11, '09 at 8:45p
activeOct 12, '09 at 11:46p
posts10
users6
websitepython.org

People

Translate

site design / logo © 2022 Grokbase