Hi all,
-- We are trying to rewrite our webplattform because it has been developed since 2009 and is more or less a patchwork of fixes.
In doing so, we want to be able to use the latest versions of all plugins and frameworks, so we are looking at:
Django 1.6 (or 1.7 if it is released before September this year)
Python 3.4
The problem we have been seeing is that some required plugins are not python 3 compatible, however, we have been able to patch them so far.
Now however I am facing a bigger problem. We are running our website on the AWS plattform, so for storage we have S3. Previously we have been using django-storages and boto so save files to S3.
I have changed to django-storages-py3 and the py3kport branch of boto. I can download files from s3 and I can load files into BytesIO objects. However I am not able to save a thumbnail image version of an image.
When I use pillow to save the image like this:
file = storage.open(output_fname, "wb")
image.save(file, "png")
file.close()
I get an exception in the image.save(file, "png") part.
File "/home/anku/.virtualenvs/env/lib/python3.3/site-packages/PIL/Image.py", line 1564, in save
save_handler(self, fp, filename)
File "/home/anku/.virtualenvs/env/lib/python3.3/site-packages/PIL/PngImagePlugin.py", line 546, in _save
fp.write(_MAGIC)
File "/home/anku/.virtualenvs/env/lib/python3.3/site-packages/storages/backends/s3boto.py", line 434, in write
return super(S3BotoStorageFile, self).write(*args, **kwargs)
TypeError: string argument expected, got 'bytes'
I understand WHY I get the error, but I can't figure out how to resolve it. Anyone have any ideas?
Regards,
Andréas
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbn5RZT0wiHULYx7TVBUXB9K1S5T18WwY_-%3Dz75OwH2rmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment