mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
met error when use code_execuation #515
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fanfan-lucky on GitHub (Aug 4, 2025).
Self Checks
Dify version
1.2.0
Plugin version
0.7.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I want to use "code execuation" to calculate the tokens of a string array, this string array is the output of "doc extract", but when I run this chat flow, the error "FileNotFoundError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']" happend, please tell me how to resolve it.
the code is:
import tiktoken
def count_tokens(string_array):
encoder = tiktoken.get_encoding("cl100k_base")
total = 0
for s in string_array:
total += len(encoder.encode(s))
return total
def main(arg1: list[str]) -> dict:
result = count_tokens(arg1)
print(result)
return {"result": result}
✔️ Error log
No response
@fanfan-lucky commented on GitHub (Aug 4, 2025):
@dosubot[bot] commented on GitHub (Aug 20, 2025):
Hi, @fanfan-lucky. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!