Is it possible to stream stderr of gsutil rsync to logs?

  gsutil, python, python-3.x, rsync, subprocess

In my application (coded in Python), I use subprocess.popen to initiate an rsync between two Google Cloud Storage locations (using gsutil).

I’m looking to provide real-time logs, and at the moment, I can only seem to access the rsync-related logs, e.g. "Starting synchronisation…Copying…" (via stderr) in a dump of all logs once the sync is complete.

command = subprocess.Popen(source_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
command.communicate()

Is there anyone to feed the results of stderr (which is where all the relevant logs seem to be being sent to) in realtime?

Thanks!

Source: Python Questions

LEAVE A COMMENT