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

watchman.checks.storage should write bytes to test-file on Py3 #101

Closed
saily opened this issue Mar 27, 2017 · 4 comments · Fixed by #102
Closed

watchman.checks.storage should write bytes to test-file on Py3 #101

saily opened this issue Mar 27, 2017 · 4 comments · Fixed by #102

Comments

@saily
Copy link
Contributor

saily commented Mar 27, 2017

Hi, i'm giving django-minio-storage a try and got an exception when storage-check is executed. I'm running Python 3.4.5 and Django 1.10.6.

Traceback (most recent call last):
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/watchman/decorators.py", line 17, in wrapped
    response = func(*args, **kwargs)
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/watchman/checks.py", line 63, in _check_storage
    path = default_storage.save(filename, ContentFile(content))
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/django/core/files/storage.py", line 54, in save
    return self._save(name, content)
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/minio_storage/storage.py", line 77, in _save
    content_type)
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/minio/api.py", line 894, in put_object
    current_data, metadata=metadata)
  File "/Users/daniel/Workspace/my_project/lib/python3.4/site-packages/minio/api.py", line 1557, in _do_put_object
    raise ValueError('Input data must be bytes type')
ValueError: Input data must be bytes type

I was able to fix it by using a byte instead of str writing to the dummy file. This should basically work on Python 2.7 - i'd file a PR later.

@mwarkentin
Copy link
Owner

@saily Thanks for the report - I'm not too familiar w/ Python 3 yet (we're starting to begin the migration though). Happy to get a fix in if you can open a PR though. :)

@mwarkentin
Copy link
Owner

If you were able to add a test which could confirm that it works on both python 2.7 and 3.x that would be super helpful!

@saily
Copy link
Contributor Author

saily commented Mar 27, 2017

Travis will hopefully do so :-)

@saily
Copy link
Contributor Author

saily commented Mar 27, 2017

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

Successfully merging a pull request may close this issue.

2 participants