I am currently rewriting a small wrapper program in python that I once wrote in C ++. It extracts files from a file and puts them in a different format.
In C ++, the output from the system commands that I need to run was "in real time", i.e. in the status bar and percentage indicator of some commands displayed in real time. With python, I get every "percentage" dumped on the screen individually (because I read it in turn). Here is an example: Here is what the status bar looks like in the python version (this extends to 100). In C ++, it updates itself.
| (02/100)\rImporting AVC-H264: | | (03/100)\rImporting AVC-H264: | | (04/100)\rImporting AVC-H264: |=
Here is the corresponding python code:
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for line in iter(p.stdout.readline, ""): print line,
Any ideas on how I can make this look like C ++?
source share