doccano-client failed to upload a file
How to reproduce the behaviour
doccano_client = DoccanoClient(
'http://127.0.0.1:8000/',
'admin',
'password'
)
project_info = doccano_client.create_project(name="First Python Project")
upload_file = doccano_client.post_doc_upload(project_id=project_info['id'],
file_name='anexample.json',
format='JSON'
)
Content of an example:
[
{
"text": "**Terrible** customer **service**.",
"label": [],
"metadata": "hi there",
"ticker": "TSL"
},
{
"text": "**Great** customer service.",
"label": [],
"metadata": "hi there",
"ticker": "TSL"
}
]
The problem is, I get exit code 0, but when I look in the dataset for the project, the content is not uploaded. It only works when I do it in GUI.
Your Environment
- Operating System:
- Python Version Used: 3.7
- When you install doccano: 7/5/21
- How did you install doccano (Heroku button etc): docker
It seems post_doc_upload is not doing anything, in that data does not appear in dataset
Yeah this is a current bug reported in doccano_client repository but it hasn't been fixed yet. If someone can check this in doccano's team it would be great
May have found the problem, you have to precise to post_doc_upload() the format you want to use. For me, as i used txt files, it looks like this:
doccano_client.post_doc_upload(project["id"], f, file_path, format="TextFile")
EDIT: You can find the list of available format here
Yes, I specified format, still doesn't do anything.
appears to be a bug as you said. Any way to programatically upload dataset without this?
Okay so I tried downloading the current code from the repo, as opposed to using pip. Now post_doc_upload works
I'm currently seeing this. Has this been fixed in the latest pull request?
Tested downloading the latest code and i'm still experiencing this.