"Error en el bus" from python

Discussion in 'Python' started by Yusniel, Oct 11, 2009.

  1. Yusniel

    Yusniel Guest

    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.
    Yusniel, Oct 11, 2009
    #1
    1. Advertising

  2. 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 D'Aprano, Oct 11, 2009
    #2
    1. Advertising

  3. Yusniel

    Yusniel Guest

    On 11 oct, 18:29, Steven D'Aprano <st...@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?.
    Yusniel, Oct 12, 2009
    #3
  4. 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, Oct 12, 2009
    #4
  5. On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel <>
    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.
    --
    Wulfraed Dennis Lee Bieber KD6MOG
    HTTP://wlfraed.home.netcom.com/
    Dennis Lee Bieber, Oct 12, 2009
    #5
  6. On Oct 11, 2009, at 11:56 PM, Dennis Lee Bieber wrote:

    > On Sun, 11 Oct 2009 13:45:54 -0700 (PDT), Yusniel <
    > >

    > 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".
    Philip Semanchuk, Oct 12, 2009
    #6
  7. Yusniel

    Yusniel Guest

    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 <

    >
    > > 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.
    Yusniel, Oct 12, 2009
    #7
  8. 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
    >>> <

    >>
    >>> 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
    Philip Semanchuk, Oct 12, 2009
    #8
  9. 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.

    --
    Carsten Haese
    http://informixdb.sourceforge.net
    Carsten Haese, Oct 12, 2009
    #9
  10. Yusniel

    Jorgen Grahn Guest

    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 .
    Jorgen Grahn, Oct 12, 2009
    #10
  11. Yusniel

    greg Guest

    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
    greg, Oct 13, 2009
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    743
  2. Paul Moore
    Replies:
    0
    Views:
    613
    Paul Moore
    Mar 1, 2008
  3. Martin v. Löwis
    Replies:
    0
    Views:
    652
    Martin v. Löwis
    Mar 1, 2008
  4. Senthil Kumaran
    Replies:
    0
    Views:
    572
    Senthil Kumaran
    Jan 17, 2011
  5. R. David Murray
    Replies:
    0
    Views:
    752
    R. David Murray
    Jan 17, 2011
Loading...

Share This Page