Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98645 > unrolled thread
| Started by | Tim Johnson <tim@akwebsoft.com> |
|---|---|
| First post | 2015-11-11 07:16 -0900 |
| Last post | 2015-11-11 07:16 -0900 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Using subprocess to capture a progress line Tim Johnson <tim@akwebsoft.com> - 2015-11-11 07:16 -0900
| From | Tim Johnson <tim@akwebsoft.com> |
|---|---|
| Date | 2015-11-11 07:16 -0900 |
| Subject | Re: Using subprocess to capture a progress line |
| Message-ID | <mailman.244.1447258619.16136.python-list@python.org> |
* Chris Warrick <kwpolska@gmail.com> [151111 00:55]: > On 10 November 2015 at 23:47, Tim Johnson <tim@akwebsoft.com> wrote: > > Using python 2.7.6 on ubuntu 14.04 <..> > There is no \n character at the end — which means that > p.stdout.readline() cannot return. In fact, if you printed repr() of > the line you read, you would get this: > > b'\r[download] 54.9% of 2.73MiB at 26.73KiB/s ETA 00:47\r[download] > 55.0% of 2.73MiB at 79.33KiB/s ETA 00:15\r…snip…\r[download] 100% of > 2.73MiB in 00:01\n' > > The download line is implemented using \r, which is the carriage > return character (return to the first character), and then by > overwriting characters that were already printed. > > The solution? There are numerous. I’ll help you by obscuring the worst one. > > (1) [recommended] figure out how to make youtube_dl work as a library, > read its main file to figure out the problem. Don’t mess with > subprocess. Was my first goal, had some problems, but I have solved them in part by finding the good documentation of the developers. I.E., the subprocess method _is_ going away and I will be using the youtube_dl module. > (2) [don’t do it] do you need to intercept the lines? If you don’t set > stderr= and stdout=, things will print just fine. Got to try that before using the module, just for edification. > (3) [DON’T DO IT] .ernq() punenpgre ol punenpgre naq znxr n zrff. > > PS. Thank you for setting a sensible Reply-To header on your messages. > Which is something the list should be doing. LOL! Glad to help :) Thanks for the reply and the further education. Cheers -- Tim http://www.akwebsoft.com, http://www.tj49.com
Back to top | Article view | comp.lang.python
csiph-web