[英]need to load the file from local drive to Google cloud platfrom cloud storage using python
i am trying to copy the file from local drive to gcp cloud storage using python code as written below but I am getting the below file not found error.我正在尝试使用下面编写的 python 代码将文件从本地驱动器复制到 gcp 云存储,但我收到以下文件未找到错误。
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users//vithal//test.csv' FileNotFoundError:[Errno 2] 没有这样的文件或目录:'C:/Users//vithal//test.csv'
''' '''
from google.cloud import storage
import os
#pip install --upgrade google-cloud-storage.
def upload_to_bucket(landing_bucket_name):
storage_client = storage.Client()
project_id = 'abc'
dataset_id = 'xyz'
landing_bucket_name = '123'
landing_blob_name = 'test_upload'
local_path = "C://Users//test.csv"
#print(buckets = list(storage_client.list_buckets())
bucket = storage_client.get_bucket(landing_bucket_name)
blob = bucket.blob(landing_blob_name)
blob.upload_from_filename(local_path)
#returns a public url
return blob.public_url
''' '''
Are you sure there is a file there?你确定那里有文件吗? It's a very strange place to store a file!
这是一个非常奇怪的存储文件的地方!
I'd expect the path to be more like c:/Users/vithaln/test.csv
我希望路径更像
c:/Users/vithaln/test.csv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.