"Error en el bus" from python

Y

Yusniel

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

Steven D'Aprano

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

Yusniel

Please post the entire traceback.

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?.
 
P

Philip Semanchuk

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
 
P

Philip Semanchuk

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".
 
Y

Yusniel

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

Philip Semanchuk

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
 
C

Carsten Haese

Yusniel said:
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.
 
J

Jorgen Grahn

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
 
G

greg

Jorgen said:
"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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top