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 failed on AWS S3 with "File was not opened in write mode" #38

Open
GitRon opened this issue Mar 27, 2018 · 6 comments
Open

Upload failed on AWS S3 with "File was not opened in write mode" #38

GitRon opened this issue Mar 27, 2018 · 6 comments

Comments

@GitRon
Copy link

GitRon commented Mar 27, 2018

Hi guys,

I'm running python 3.6.x with django 1.11.11 on gunicorn 19.7.1.

When I upload a file, I get the following error:

"File was not opened in write mode."

Sentry points me to this line:

    self.file.open(mode='ab')  # mode = append+binary
    # We can use .read() safely because chunk is already in memory
    self.file.write(chunk.read())

I already checked this issue but it was related to an old version of django.

Any ideas?

Thanks
Ron

PS: Maybe this is related to my storage of media files on AWS S3? Chunked parts are created but have size zero.

@GitRon GitRon changed the title Upload failed with "File was not opened in write mode" Upload failed on AWS S3 with "File was not opened in write mode" Mar 27, 2018
@sighmon
Copy link

sighmon commented Sep 27, 2018

@GitRon Did you find a solution?

@GitRon
Copy link
Author

GitRon commented Oct 2, 2018

@sighmon I branched out and this is my solution: https://github.com/GitRon/django-chunked-upload

@birkanozer
Copy link

nice fix

@GitRon
Copy link
Author

GitRon commented Jun 15, 2020

@birkanozer Unfortunately we are stuck here...

@awwester
Copy link

Unfortunately we are stuck here...

@GitRon Does that mean you weren't able to get a full working solution? I've seen some other errors downstream as well, so curious if you ended up getting it fully working.

@GitRon
Copy link
Author

GitRon commented Jan 18, 2021

I wanted to add the general fix for using a temporary storage. But the guy who took over the project started changing way more things. Variable names etc. IMHO this is too big for now and will cause loads of problems for people using the package. We somehow got lost along the way and since some time I haven't heard or (I have to admit) said anything on this topic.

My dream scenario would be that we start where the old maintainer left of, merge in my fix, maybe I have to update the docs a bit because the fix is just also a fix for the cloud. But it can be used in other circumstances as well.

When this is one the road, we could discuss in an issue if renaming variables etc is a proper way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants