比如用户上传一个excel/pdf文件,想使用工具中的python函数读取文件,进行转换,然后在界面上提供转换后的文件下载。
使用时,将{{开始.document[0].file_id}} 拼接之后得到文件URL: https://192.168.1.10:8180/admin/oss/file/019bf84d-d983-7bf1-8bef-871f4034cb7a
函数按URL读取文件时,后台日志报错,请帮忙看看。
2026-01-26 14:04:26 [handle_exception ERROR] 读取Excel文件失败,错误:[Errno 13] Permission denied: ‘./oss/file/019bf84d-d983-7bf1-8bef-871f4034cb7a.xlsx’:Traceback (most recent call last):
File “/opt/py3/lib/python3.11/site-packages/rest_framework/views.py”, line 512, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/common/auth/authentication.py”, line 111, in run
return func(view, request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/tools/views/tool.py”, line 102, in post
).debug(request.data))
^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/tools/serializers/tool.py”, line 423, in debug
return tool_executor.exec_code(code, all_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/opt/maxkb-app/apps/common/utils/tool_code.py”, line 85, in exec_code
raise Exception(result.get(‘msg’))
Exception: 读取Excel文件失败,错误:[Errno 13] Permission denied: ‘./oss/file/019bf84d-d983-7bf1-8bef-871f4034cb7a.xlsx’