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
'str' does not support the buffer interface #216
Comments
file_contents = 'I am content of file 2' After upgrading to Python 3.7 StringIO supports ByteIO, but it did not in 3.3. The code above would be more accurate. |
@jonfen You're absolutely right that one should use
So basically what we need to do is to convert our unicode strings to bytes before feeding a file-like object to Python-Redmine which is exactly what I'm doing now in c8b49bd. Since it's a clients application failure and it requires Python-Redmine to do some unnecessary things, I'm emitting a Thank you very much for rasing this issue as it helped to find this nasty bug. |
Redmine Server: 4.0.4 error: Cannot upload this type of attachment |
@1508zb Your code works perfectly fine for me using Python 3.7 and Redmine 4.0.4. |
@maxtepkeev Thank you for help! What's your version of python-redmine, please? And what do you think are the possible causes of this situation? My Redmine does not limit this type of attachment, such as png and so on. |
@maxtepkeev This is my error screenshot。Chinese error message is not allowed to upload this type of attachment |
@1508zb I used the latest version (2.2.1). This error comes from Redmine and has nothing to do with Python-Redmine. There might be some plugin blocking uploads. You can check your code against a public Redmine demo http://demo.redmineup.com (admin:admin) and see if it works there (it should). If it works that means it's your Redmine server that is not allowing you to upload these files and you should consult with Redmine people about this. |
@maxtepkeev Thank you for your answer!My code works fine against a public Redmine demo http://demo.redmineup.com. For our Redmine, if it sets the type of attachments that are allowed to be uploaded, my code failed although the attachment type I am uploading is allowed. But if it doesn't restrict any attachment types to upload, my code works successfully. Do you know why, please? And dose the public Redmine that you gave limit the types of attachments we can upload? |
@1508zb I found the cause of this problem and I can fix it on Python-Redmine side. Fix will be available ASAP. |
@maxtepkeev Thank you so much for help! What is the cause of this problem? Is it a bug of Redmine? Looking forward to your new version of Python-Redmine! |
The uploads portion of the following example code fails with the error above for both create() and save(), removing the uploads assignment makes the call successful, but not valuable:
https://python-redmine.com/resources/issue.html?highlight=stringio
produces error:
'str' does not support the buffer interface
Redmine Server: 3.2.0
Python: 3.3
OS: Windows 10 Pro
The text was updated successfully, but these errors were encountered: