6.3.1.7. Standard Input

6.3.1.7. Standard Input

Start python section to interscript/drivers/sources/stdin.py[1]
     1: #line 547 "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: 
    10: class stdin_source(source):
    11:   def __init__(self):
    12:     source.__init__(self)
    13:     self.name = 'standard input'
    14:     self.closed = 0
    15: 
    16:   def readline(self):
    17:     if self.closed:
    18:       raise eof
    19:     line = sys.stdin.readline()
    20:     if len(line)==0: raise eof
    21:     self.lines_read = self.lines_read + 1
    22:     return line
End python section to interscript/drivers/sources/stdin.py[1]