Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload_fileobj closes the file #929

Closed
josepablog opened this issue Dec 24, 2016 · 2 comments
Closed

upload_fileobj closes the file #929

josepablog opened this issue Dec 24, 2016 · 2 comments
Labels
bug This issue is a confirmed bug.

Comments

@josepablog
Copy link

Hello,

upload_fileobj has an undocumented behavior that I think it's a bug. It closes the file after uploading the file ! :(

To reproduce this behavior:

import boto3
import cStringIO

f = cStringIO.StringIO("hello")
print f.getvalue()
print f.getvalue() # Second call works!

session = boto3.Session()
s3 = session.resource('s3')
obj = s3.Object(bucket_name, key)

obj.upload_fileobj(f)

print f.getvalue() # Raises an exception

@JordonPhillips
Copy link
Contributor

Thanks for reporting! I've opened the issue in s3transfer which provides the functionality for upload_fileobj. Closing out here.

@saranglakare
Copy link

5 years and this issue still exists. No one has even bothered to update the documentation of upload_fileobj to mention that the file pointer will be closed! I just wasted a couple of hours figuring out an issue which was due to this bug :( I request this issue be kept open till it is fixed. Simply delegating it to an issue in another tool is not the solution. At the very least update the documentation! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

3 participants