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

Upload file failed #13

Closed
ChiLynn123 opened this issue Sep 27, 2020 · 1 comment · Fixed by #108
Closed

Upload file failed #13

ChiLynn123 opened this issue Sep 27, 2020 · 1 comment · Fixed by #108
Assignees
Labels
bug Something isn't working

Comments

@ChiLynn123
Copy link

Hello, I made an error uploading the document using the API, but the document can appear in the Doccano instance database. Looking forward to your reply to my questions, thank you very much!

r_du = doccano_client.post_doc_upload(8, "csv", "data_xa.csv", "D:\WPSCloud")

error:
Traceback (most recent call last): File "D:/doccano/doccano-client/doccano_api_client/example.py", line 113, in <module> r_du = doccano_client.post_doc_upload(8, "csv", "data_xa.csv", "D:\WPSCloud") File "D:\doccano\doccano-client\doccano_api_client\__init__.py", line 521, in post_doc_upload data=data File "D:\doccano\doccano-client\doccano_api_client\__init__.py", line 64, in post request_url, data=data, files=files, json=json).json() File "E:\Anaconda\lib\site-packages\requests\models.py", line 885, in json return complexjson.loads(self.text, **kwargs) File "E:\Anaconda\lib\json\__init__.py", line 354, in loads return _default_decoder.decode(s) File "E:\Anaconda\lib\json\decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "E:\Anaconda\lib\json\decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@kris927b
Copy link

kris927b commented Oct 6, 2020

Hi.

I get the same error when trying to upload. It seems to be the response from the API.
Hope they can come up with a solution to this. 👍

I can catch the error, and upload all my documents by doing the following:

try:
    out = client.post_doc_upload(project, 'json', name, d)
except json.decoder.JSONDecodeError:
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants