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 2021/05/30 16:50:10 UTC

[GitHub] [airflow] potiuk edited a comment on issue #16148: Downloading files from S3 broken in 2.1.0

potiuk edited a comment on issue #16148:
URL: https://github.com/apache/airflow/issues/16148#issuecomment-851028624


   You have bad indentation in your last example:
   
   ```
       with open('/tmp/s3_hook.txt', 'w') as f:
           s3.Bucket(bucket).Object(key).download_file(f.name)
           logging.info(f"File downloaded: {f.name}")
   
           with open(f.name, 'r') as f_in:
               logging.info(f"FILE CONTENT {f_in.read()}")
   ```
   
   Should be:
   
   ```
       with open('/tmp/s3_hook.txt', 'w') as f:
           s3.Bucket(bucket).Object(key).download_file(f.name)
           logging.info(f"File downloaded: {f.name}")
   
       with open(f.name, 'r') as f_in:
           logging.info(f"FILE CONTENT {f_in.read()}")
   ```
   
   You are trying to read the file before it has been closed and flushed (which will happen when you exit "with" clause).


-- 
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