using boto to upload csv file into Amazon S3 bucket

Neil

I am trying to upload csv file to my existing Amazon S3 bucket named 'my-bucketname' in python using boto

I get an error 'NoneType' object has no attribute 'set_contents_from_filename'

So i guess I am not able to establish connection properly with S3 bucket.

Could anyone help me with this?

Here is my code.

s3conn = boto.connect_s3(aws_access_key_id,aws_secret_access_key)
upload_file = '/home/csvfilename.csv'
key = s3conn.get_bucket('my-bucketname').get_key('csvfilename.csv')
key.set_contents_from_filename(upload_file)

UPDATED

    s3Conn = boto.connect_s3(access_key,secret_key)
    bucket2 = self.s3Conn.lookup('my-bucket-name')
    k = Key(bucket2)
    k.Key = "sg_details.csv"
    k.set_contents_from_filename("sg_details.csv")
Siddarth
bucket2 = conn.lookup(bucketname)
k = Key(bucket2) 
k.key = filename
  k.set_contents_from_filename(filename) 
print('Completed')

Try this, this should work properly. I am not sure why you used getkey

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error 500 while Uploading CSV file to S3 bucket using boto3 and python flask

From Dev

Upload multiple file in amazon s3 bucket using java filechooser

From Dev

Angular2 File upload for Amazon s3 bucket

From Dev

Amazon s3 file upload to bucket not redirecting after success

From Dev

amazon s3, upload file in folder in bucket

From Dev

How to upload a thumbnail file to a amazon s3 bucket?

From Dev

Amazon AWS Cognito and Python Boto3 to establish AWS connection and upload file to Bucket

From Java

How to upload a file into S3 bucket using CloudFormation script?

From Dev

upload file using flask to amazon s3

From Dev

Amazon S3 - Batch File Upload Using Java API?

From Dev

upload file using flask to amazon s3

From Dev

Upload to Amazon S3 using Boto3 and return public url

From Dev

How to display file upload progress in progressbar - Amazon S3 bucket

From Dev

Request fails when trying to directly upload file to amazon S3 bucket

From Dev

Amazon S3 bucket file upload : Invalid Transfer encoding header

From Dev

Updating a file in Amazon S3 bucket

From Dev

Invalid timestamp error when trying to get CSV file from and S3 bucket using boto3 module in python2.7

From Dev

Uploading a file to a S3 bucket with a prefix using Boto3

From Dev

Writing csv file to Amazon S3 using python

From Dev

Is boto3.Bucket.upload_file blocking or non-blocking?

From Dev

How to check if a file has completed uploading into S3 Bucket using Boto in Python?

From Dev

Amazon s3 boto3: Check if upload is done

From Dev

Amazon S3 Bucket Upload all files empty

From Dev

Get Notified when upload is completed in Amazon S3 bucket

From Dev

Allow a group to upload files on an Amazon S3 bucket

From Dev

Upload file to S3 using Ajax and Boto3 for Django

From Dev

Upload a file to Amazon S3 with NodeJS

From Dev

Nodejs Amazon S3 File Upload

From Dev

Upload a file using boto

Related Related

  1. 1

    Error 500 while Uploading CSV file to S3 bucket using boto3 and python flask

  2. 2

    Upload multiple file in amazon s3 bucket using java filechooser

  3. 3

    Angular2 File upload for Amazon s3 bucket

  4. 4

    Amazon s3 file upload to bucket not redirecting after success

  5. 5

    amazon s3, upload file in folder in bucket

  6. 6

    How to upload a thumbnail file to a amazon s3 bucket?

  7. 7

    Amazon AWS Cognito and Python Boto3 to establish AWS connection and upload file to Bucket

  8. 8

    How to upload a file into S3 bucket using CloudFormation script?

  9. 9

    upload file using flask to amazon s3

  10. 10

    Amazon S3 - Batch File Upload Using Java API?

  11. 11

    upload file using flask to amazon s3

  12. 12

    Upload to Amazon S3 using Boto3 and return public url

  13. 13

    How to display file upload progress in progressbar - Amazon S3 bucket

  14. 14

    Request fails when trying to directly upload file to amazon S3 bucket

  15. 15

    Amazon S3 bucket file upload : Invalid Transfer encoding header

  16. 16

    Updating a file in Amazon S3 bucket

  17. 17

    Invalid timestamp error when trying to get CSV file from and S3 bucket using boto3 module in python2.7

  18. 18

    Uploading a file to a S3 bucket with a prefix using Boto3

  19. 19

    Writing csv file to Amazon S3 using python

  20. 20

    Is boto3.Bucket.upload_file blocking or non-blocking?

  21. 21

    How to check if a file has completed uploading into S3 Bucket using Boto in Python?

  22. 22

    Amazon s3 boto3: Check if upload is done

  23. 23

    Amazon S3 Bucket Upload all files empty

  24. 24

    Get Notified when upload is completed in Amazon S3 bucket

  25. 25

    Allow a group to upload files on an Amazon S3 bucket

  26. 26

    Upload file to S3 using Ajax and Boto3 for Django

  27. 27

    Upload a file to Amazon S3 with NodeJS

  28. 28

    Nodejs Amazon S3 File Upload

  29. 29

    Upload a file using boto

HotTag

Archive