Cannot call a s-lang method in an object

Marco Herrn herrn at gmx.net
Fri Oct 18 15:53:19 EDT 2002


Hi there,

first, sorry for the crossposting, but I don't know which newsgroup
would be more appropriate.

I am trying to write a program in python that uses s-lang for color
output and keyboard handling (by using python-slang). 

Now, for the following code, everything runs fine:

----------
#! /usr/bin/env python

from PySlang import *
import sys

def out():
    SLsmg_write_string("test")


sl_init()
out()
SLsmg_refresh()
sl_exit()
----------

But when putting the out() method in a class, it doesn't work:

----------
#! /usr/bin/env python

from PySlang import *
import sys

class Test:
    def out():
        SLsmg_write_string("test")

sl_init()
test= Test()
test.out()
SLsmg_refresh()
sl_exit()
----------

Then I see nothing and my screen is scrambled.
Now I assume that there is an exception somewhere (I mean it is exactly
when call the method test.out()). But I don't see the stacktrace. Surely
this is because s-lang is hiding the output.

But how can I see the stacktrace?
And why should it be a problem to call this method from a function?

Bye
Marco

-- 
Marco Herrn             herrn at gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736




More information about the Python-list mailing list