Using subprocess to capture a progress line

Tim Johnson tim at akwebsoft.com
Tue Nov 10 19:14:36 EST 2015


* Tim Johnson <tim at akwebsoft.com> [151110 14:55]:
> * Chris Angelico <rosuav at gmail.com> [151110 14:35]:
> > On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson <tim at akwebsoft.com> wrote:
> > > I've written a command-line "wrapper" for youtube-dl, executing
> > > youtube-dl as a subprocess.
> > >
> > > ------------------------------------------------------------------
> > > youtube-dl reports download progress on one line. I.E. the line is
> > > overwritten numerous times with no carriage return until the
> > > downloading is finished.
> > > ------------------------------------------------------------------
> > >
> > 
> > Sounds to me like a possible buffering problem. But since youtube-dl
> > is implemented in Python, you might find it easier to "pip install
> > youtube_dl" and work with the methods directly:
> 
>   As for the buffering issue, at this point, I'll try  using a
>   lower-level function like sys.stdout.write when the line 
>   tests for '[download]' and 'ETA'.
    That method doesn't work ... so far. Oh well.
-- 
Tim 
http://www.akwebsoft.com, http://www.tj49.com



More information about the Python-list mailing list