Test for the bug with TypeError while saving BytesIO object. #3

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants

This test reproduces the bug I encountered with Python3.3:
TypeError: string argument expected, got 'bytes'

It happens because this method does not taking in attention type of a content being saved, and InMemoryFile uses StringIO by default. InMemoryDir opens file and then tries to write bytes to it, and it produces a bug. I have no idea rigt now, how would be better to fix this.

Owner

nickpresta commented Jun 1, 2014

Hi Andrew,

Thanks for the bug report (demonstrated by a test, no less!). I will take a look at it this week. I have an idea of how to deal with this in a sane way for both Python 2 and 3.

zsiciarz commented Jun 6, 2014

This is not a real fix, just a workaround for my case (Python 3.3, always writing bytes): zsiciarz/dj-inmemorystorage@1c30c38
Looking forward to proper fix!

meshy commented Nov 12, 2014

Hi there. I've made a PR into this branch that (I am relatively certain) will make this test pass.

@meshy meshy referenced this pull request Nov 12, 2014

Closed

BytesIO TypeError #7

meshy added a commit to incuna/dj-inmemorystorage that referenced this pull request Nov 12, 2014

@meshy meshy referenced this pull request Nov 12, 2014

Merged

BytesIO TypeError #8

@nickpresta nickpresta closed this in #8 Nov 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment