Guest User

Untitled

a guest
Mar 18th, 2013
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. # test.py - открываем в браузере
  2.  
  3. #!/usr/bin/env python3
  4. import subprocess, sys
  5. sys.stdout.buffer.write(b'Content-type: text/html;charset=utf-8\n\n')
  6. r = subprocess.Popen('./test2.py | at now', shell=True) # пробовал и shell=False, передавая аргументы списком
  7. print('finished')
  8. exit(0)
  9.  
  10. # test2.py - бесконечно пишет в файл test, пока работает
  11.  
  12. #!/usr/bin/env python3
  13. import time, sys
  14. fp = open('test', 'w')
  15. while True:
  16.     print('.',end='')
  17.     fp.write('1')
  18.     fp.flush()
  19.     sys.stdout.flush()
  20.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment