Last active
April 4, 2017 10:52
-
-
Save louisswarren/a315c18f415ce0179b9dfaddebfc359c to your computer and use it in GitHub Desktop.
Python script for running a guile instance as a server, with a file as input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
import os | |
import time | |
filename = '/home/louis/minlog/.guileman.txt' | |
f = open(filename, 'w') | |
f.write('\n') | |
f.close() | |
def do_events(): | |
with open(filename, 'r') as f: | |
print(f.read()) | |
while True: | |
mtime = os.stat(filename).st_mtime | |
do_events() | |
sys.stdout.flush() | |
while True: | |
try: | |
if mtime != os.stat(filename).st_mtime: | |
break | |
except FileNotFoundError: | |
pass | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment