6.13.1.7. Standard Input

Start python section to interscript/drivers/sources/stdin.py[1 /1 ]
     1: #line 702 "source_drivers.ipk"
     2: #---------------------------------------------------------
     3: # gets input from _python_ sys.stdin object
     4: # same as named_file_source, except named 'standard input'
     5: # and doesn't close file on destruction
     6: import sys
     7: from interscript.drivers.sources.base import source
     8: from interscript.drivers.sources.base import eof
     9: import string
    10: 
    11: class stdin_source(source):
    12:   def __init__(self, encoding='utf8',**kwds):
    13:     apply(source.__init__,(self,encoding), kwds)
    14:     self.name = 'standard input'
    15:     self.closed = 0
    16: 
    17:   def _raw_readline(self):
    18:     if self.closed:
    19:       raise eof
    20:     line = sys.stdin.readline()
    21:     if len(line)==0: raise eof
    22:     self.lines_read = self.lines_read + 1
    23:     return string.rstrip(line)
    24: 
End python section to interscript/drivers/sources/stdin.py[1]