Python Forum
Scraping apps output. - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Scraping apps output. (/thread-13531.html)



Scraping apps output. - MuntyScruntfundle - Oct-19-2018

Hi folks.

I've been doing a bit of Blender rendering on a couple of pis (Debian) recently, it actually works really well, if a little slow.

The Blender app churns away and generates a whole load of text output, but no timing information. I'd like to build in some trigger points like 'tile complete', 'frame complete' etc, the developers haven't got back to me about this, so I've been trying to think of other ways to do this.

From the command line I could send the output of the app anywhere, so in theory I could monitor that data file. However, I'm unsure how to do this.

It would have to work offline as well as live, so it would need to be able to process an existing file line by line, or act on a new line written to the file, obviously the time information would only be accurate in live mode. It must never act on the same line twice so I'd need to prepend each line with s special character after processing. It needs an offline/catchup mode incase of a crash or forgetting to start the scraper before blender, which I'm quite likely to do!

The trigger actions will be pretty simple 'write a line to a file' kind of thing.

I'm much better with Python than bash, but would consider either. How would you folks go about such a thing?

Many thanks.


RE: Scraping apps output. - buran - Oct-19-2018

It's not clear, can you use subprocess.check_output()?
also you can watchdog to monitor the file system for file changes


RE: Scraping apps output. - MuntyScruntfundle - Oct-19-2018

I got all excited when I stumbled on pyinotify, but I can only find examples for monitoring files in and out of directories, not lines added to individual files.