Re-assigning 'stdin' Problem...

Kim Jeong Ju haje01 at netsgo.com
Mon Jan 24 12:21:41 EST 2000


Hi!
I am a newbie to Python and having some trouble.

What I want to do is re-assigning standard input
to my own version of console system. ( it uses c string
buffer inside. )

I made a console class in order to link Python's stdin
to my c string buffer..

class MyConsole:
    def readline( self ):
        if ( self.BufferHasData )
            return self.GetBufferData()
        else
->        return ""

    def InBufferHasData( self )
            .
            .
    def GetBufferData( self )
            .
            .

sys.stdin = MyConsole()

When stdin is in need, like running 'pdb' procedure,
system hangs out.

I guess that marked line in readline function is problem.
if i replace it with 'return None ', interpreter complains
that it is not string object...
I guess I must stop the Python interpreter from requesting
more readline.

What can I do to fix this problem? You could just drop me a
link to a reference.

Any suggestions, instructions and helps appreciated ahead..

Bye.

from Kim Jeong Ju.






More information about the Python-list mailing list