| Last change
 on this file since 14162 was             52, checked in by rissim, 16 years ago | 
        
          | trigger software (VME) v1 | 
        
          | 
              
Property                 svn:executable
 set to                 * | 
        
          | File size:
            417 bytes | 
      
      
| Line |  | 
|---|
| 1 | #!/usr/bin/python | 
|---|
| 2 | import sys, os, select, time | 
|---|
| 3 |  | 
|---|
| 4 | i = 0 | 
|---|
| 5 |  | 
|---|
| 6 | def getInput(): | 
|---|
| 7 | input = '' | 
|---|
| 8 | while len(select.select([sys.stdin.fileno()], [], [], 0.0)[0])>0: | 
|---|
| 9 | input += os.read(sys.stdin.fileno(), 4096) | 
|---|
| 10 | return input | 
|---|
| 11 |  | 
|---|
| 12 | def doWork(): | 
|---|
| 13 | global i | 
|---|
| 14 | time.sleep(0.5) | 
|---|
| 15 | i += 1 | 
|---|
| 16 |  | 
|---|
| 17 | if __name__=='__main__': | 
|---|
| 18 | input = '' | 
|---|
| 19 | while not input: | 
|---|
| 20 | doWork() | 
|---|
| 21 | input = getInput() | 
|---|
| 22 | print "got user input: %r" % input | 
|---|
| 23 | print "did %d units of work" % i | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.