Вот мой код:
Код: Выделить всё
from google.cloud import storage
import io
import paramiko
# connection parameters
host = 'host'
port = 22
usr = 'me'
pwd = '0123'
# Connect to the SFTP server
sftp_client = paramiko.SSHClient()
sftp_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
sftp_client.connect(host, port, usr, pwd)
sftp = sftp_client.open_sftp()
# Get the file
sftp_file = sftp.open('./file.csv', 'rb')
# Call the Google Cloud Storage API
storage_client = storage.Client()
bucket_name = 'the_bucket'
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(sftp_file)
# Upload to bucket
blob.upload_from_filename(sftp_file)
ValueError: объект
не удалось преобразовать в Юникод
Может кто-нибудь меня отклеить?>
Подробнее здесь: https://stackoverflow.com/questions/789 ... to-unicode
Мобильная версия