1

When I run my python script for downloading an image from Firebase storage I get the following error "PermissionError: [Errno 13] Permission denied:". I have tried running as administrator without success and also checked the permissions and it appears in my settings I have full read and write access so I'm not sure what to do?

This is the code I am running:

import os 
from google.cloud import storage
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = 'C:/Users/username/Documents/NNFILES/credential_file.json'
storage_client = storage.Client()
bucket = storage_client.get_bucket('project.appspot.com')
imageBlob = bucket.blob("/")
imagePath1 = "C:\\Users\\username\\Downloads"
Blob = bucket.blob('result_5.png')
Blob.download_to_filename(imagePath1)
Blob.download_as_string()

Also to add I am successfully uploading to Firebase storage so I do not think it is an issue with the .json file or Firebase.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
tech123
  • 13
  • 1
  • 7
  • Permissions being denied generally mean that your credentials are incorrect. Try double checking your environment variable? – 12944qwerty Apr 20 '21 at 15:30
  • Does this answer your question? [Errno 13 Permission denied Python](https://stackoverflow.com/questions/41910583/errno-13-permission-denied-python) – esqew Apr 20 '21 at 15:32
  • Hi, thanks for the response. No as I have already tried running python as admin and I have also checked the permissions through windows and I have read and write access – tech123 Apr 20 '21 at 15:38

1 Answers1

1

imagePath1 = "C:\\Users\\username\\Downloads" is not a filename. You're trying to copy a file over the top of a directory. You need to add the file name to the end of that string.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30