Skip to content

Instantly share code, notes, and snippets.

@louisswarren
Last active April 4, 2017 10:52
Show Gist options
  • Save louisswarren/a315c18f415ce0179b9dfaddebfc359c to your computer and use it in GitHub Desktop.
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
#!/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