You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/09/20 12:31:04 UTC

[GitHub] [airflow] feluelle commented on a change in pull request #6097: [AIRFLOW-5478] Decode PythonVirtualenvOperator Output to Logs

feluelle commented on a change in pull request #6097: [AIRFLOW-5478] Decode PythonVirtualenvOperator Output to Logs
URL: https://github.com/apache/airflow/pull/6097#discussion_r326603942
 
 

 ##########
 File path: airflow/operators/python_operator.py
 ##########
 @@ -334,7 +334,7 @@ def _execute_in_subprocess(self, cmd):
             self.log.info("Executing cmd\n%s", cmd)
             output = subprocess.check_output(cmd,
                                              stderr=subprocess.STDOUT,
-                                             close_fds=True)
+                                             close_fds=True).decode('utf-8')
 
 Review comment:
   From: https://docs.python.org/3/library/subprocess.html#subprocess.check_output
   > By default, this function will return the data as encoded bytes. The actual encoding of the output data may depend on the command being invoked, so the decoding to text will often need to be handled at the application level.
   
   I think it is fine to decode it at that level, but then we should set the encoding in the `check_output` as well to `encoding='utf-8'`, don't you think so?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services