[Bug]: when post /project/add, service failed to parse uploaded txt or pdf document. error message: "name 'enc' is not defined "
gobigrassland opened this issue · 2 comments
gobigrassland commented
Current Behavior
curl -X 'POST' \
'http://localhost:8900/project/add?project=test' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@test.txt;type=text/plain'
Response body
[
{
"status": false,
"msg": "Failed to load data:\nNode-token-counter-1 runs failed, error msg: name 'enc' is not defined, Traceback (most recent call last):\n File \"/export/xxx/anaconda3/envs/akcio/lib/python3.10/site-packages/towhee/runtime/nodes/node.py\", line 158, in _call\n return True, self._op(*inputs), None\n File \"/home/xxx/.towhee/operators/towhee/token-counter/versions/main/count_token.py\", line 13, in __call__\n num_tokens = len(enc.encode(str(data)))\nNameError: name 'enc' is not defined\n, Traceback (most recent call last):\n File \"/export/xxx/anaconda3/envs/akcio/lib/python3.10/site-packages/towhee/runtime/nodes/node.py\", line 171, in process\n self.process_step()\n File \"/export/xxx/anaconda3/envs/akcio/lib/python3.10/site-packages/towhee/runtime/nodes/_map.py\", line 63, in process_step\n assert succ, msg\nAssertionError: name 'enc' is not defined, Traceback (most recent call last):\n File \"/export/xxx/anaconda3/envs/akcio/lib/python3.10/site-packages/towhee/runtime/nodes/node.py\", line 158, in _call\n return True, self._op(*inputs), None\n File \"/home/xxx/.towhee/operators/towhee/token-counter/versions/main/count_token.py\", line 13, in __call__\n num_tokens = len(enc.encode(str(data)))\nNameError: name 'enc' is not defined\n\n\n"
},
400
]
towhee version: 1.1.1
Expected Behavior
No response
Steps To Reproduce
No response
Environment
No response
Anything else?
No response
jaelgu commented
Can you remove old operator and then restart your service?
rm ~/.towhee/operators/towhee/token-counter
The token-counter
operator has been fixed a few days ago but it seems you've used it before that.
gobigrassland commented
thanks. solved the problem~