I am trying to upload an excel and pdf file from local disk to google cloud storage . Excel is creating using pandas library in python. When i try to upload the generated file it is giving this error
'ascii' codec can't decode byte 0xd0 in position 217: ordinal not in range(128)
I am using flexible appengine. Here is the upload file code
def upload_to_gcs(file_path,file_name,file_type,bucket_name):
try:
import google.cloud.storage
storage_client = google.cloud.storage.Client.from_service_account_json(
os.getcwd()+'relative_path_of_service_json_file')
bucket = storage_client.get_bucket('bucket_name')
d = bucket.blob(bucket_name+'/'+file_name+'.'+file_type)
d.upload_from_filename(file_path)
except Exception, e:
print str(e)
Thanks in advance