Linux python read output from a running python script -
i have python script running service in linux (also autorun), , plenty of output! how can read output when program running?
maybe log output file have open , refresh file time when new output logged!
it possible implement tail python side, continuous reading of it. code snippet make work can found here:
http://code.activestate.com/recipes/157035-tail-f-in-python/
additionally, if use append mode of file writing instead of write method can continuously output.
scrapy uses concept of pipelines allow lot of same functionality. here's example of scrapy code might use same thing:
class jsonwriterpipeline(object): def __init__(self): self.file = (open(filepath, 'a')) def process_item(self, item, spider): self.file.write(json.dumps(dict(item)) + '\n') return item
Comments
Post a Comment