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

Error using Jieba in dify-sandbox: Operation not permitted #97

Open
XiaoLey opened this issue Oct 10, 2024 · 2 comments
Open

Error using Jieba in dify-sandbox: Operation not permitted #97

XiaoLey opened this issue Oct 10, 2024 · 2 comments

Comments

@XiaoLey
Copy link

XiaoLey commented Oct 10, 2024

Hi there! I'm having trouble using the Jieba library for word segmentation in the dify-sandbox environment. When I run the code below, I get the error message: "Building prefix dict from the default dictionary ... error: operation not permitted."

import jieba

def main(input_content: str, reference_cost: int) -> dict:
    words = jieba.lcut(input_content)
    word_count = len(words)

    W_w = 0.005
    real_cost = W_w * word_count

    return {
        "real_cost": real_cost,
    }

It seems like this error is related to permission issues when Jieba tries to build a prefix dictionary from the default dictionary. I'm wondering if there's a way to solve this problem, or if there's an alternative method for word segmentation that works smoothly in dify-sandbox. Additionally, could you provide any solutions or relevant resources to address this issue? Thanks a bunch!

@Hisir0909
Copy link

@svcvit
Copy link

svcvit commented Nov 22, 2024

I’ve created a simplified code runner that is compatible with the current sandbox. You only need to replace the image to use it. Feel free to check it out if you're interested: https://github.com/svcvit/dify-sandbox-py.

Xnip2024-11-22_10-03-24

Xnip2024-11-22_10-03-17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants