juliomalegria / django-chunked-upload

Upload large files to Django in multiple chunks, with the ability to resume if the upload is interrupted.
MIT No Attribution
218 stars 73 forks source link

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

Open GitRon opened 6 years ago

GitRon commented 6 years ago

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.

sighmon commented 6 years ago

@GitRon Did you find a solution?

GitRon commented 6 years ago

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

birkanozer commented 4 years ago

nice fix

GitRon commented 4 years ago

@birkanozer Unfortunately we are stuck here...

awwester commented 3 years ago

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 commented 3 years ago

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.