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
'_io.BytesIO' object has no attribute 'name' #175
Comments
Thanks for reporting this issue @jeffgerhard! This could be addressed by not requiring a file-like object to have a name attribute if a key is specified. Then you could do something like:
In the meantime, I think you should be able to do something like the following to get around this issue:
Does that make sense? I'll try get around to resolving this issue soon. |
Hi Jake, that totally makes sense, I should have thought of that. The ideal scenario you mentioned first (basically as described in readthedocs) is what I was already doing before the name attr became required. Thanks! |
Alright, I think d98925b should fix this. I haven't published a new version yet, but if you're able to install the github master branch this should now be fixed there. This will be in version 1.2.0. I have a few other features I'm working on that I'd like to complete before I release this version. Thanks again @jeffgerhard! |
Hi,
I'm getting errors trying to upload a binary file-like object. This was working before I updated internetarchive a few weeks ago. (Usage: I'm compiling binary MARC records in python to upload alongside of existing PDF files.)
It seems like this update #162, when resolving this filename issue #163 in item.py, may not be taking into account file-like objects that don't have a name attribute? The relevant section is here.
I'm very much an amateur here so I could be overlooking something. I'm using Windows 7, Python 3.5.2. Here are my traceback messages, and I can supply my local code if it would help.
Traceback (most recent call last):
File "C:\Users\gerhardj\repos\sierra_api\new_pdf_upload.py", line 106, in metadata=md, verbose=True)
File "C:\Anaconda3\lib\site-packages\internetarchive\api.py", line 285, in upload request_kwargs=request_kwargs)
File "C:\Anaconda3\lib\site-packages\internetarchive\item.py", line 751, in upload request_kwargs=request_kwargs)
File "C:\Anaconda3\lib\site-packages\internetarchive\item.py", line 522, in upload_file
filename = body.name
AttributeError: '_io.BytesIO' object has no attribute 'name'
Thanks for any help or suggestions!
The text was updated successfully, but these errors were encountered: