hhyo / Archery

SQL 审核查询平台
https://archerydms.com
Apache License 2.0
6.1k stars 1.69k forks source link

1.11.3版本按照教程部署后提交sql分析后报:TypeError: expected str, bytes or os.PathLike object, not NoneType #2840

Open mofan0920 opened 1 month ago

mofan0920 commented 1 month ago

重现步骤

  1. SQL审核->SQL分析 2. 上传SQL文件 3.选择实例和数据库(数据库连接测试是成功的)4.点击“开始分析”,弹窗提示:未知错误,请联系管理员处理! 5.日志显示:TypeError: expected str, bytes or os.PathLike object, not NoneType

预期外的结果

弹窗提示:未知错误,请联系管理员处理! 日志显示:TypeError: expected str, bytes or os.PathLike object, not NoneType

日志文本

[root@10 docker-compose]# docker logs archery -f --tail=50
  File "<frozen posixpath>", line 152, in dirname
TypeError: expected str, bytes or os.PathLike object, not NoneType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/sql_analyze.py", line 93, in analyze
    stdout, stderr = soar.execute_cmd(cmd_args).communicate()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/plugins/plugin.py", line 87, in execute_cmd
    raise RuntimeError("命令执行失败,失败原因:%s" % str(e))
RuntimeError: 命令执行失败,失败原因:expected str, bytes or os.PathLike object, not NoneType
2024-10-15 10:22:27,582 - django.request - ERROR - Internal Server Error: /sql_analyze/analyze/
Traceback (most recent call last):
  File "/opt/archery/sql/plugins/plugin.py", line 77, in execute_cmd
    p = subprocess.Popen(
        ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.11/subprocess.py", line 1824, in _execute_child
    and os.path.dirname(executable)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 152, in dirname
TypeError: expected str, bytes or os.PathLike object, not NoneType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv4archery/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/archery/sql/sql_analyze.py", line 93, in analyze

版本

1.11.3

部署方式

Docker

是否还有其他可以辅助定位问题的信息?比如数据库版本等

No response

mofan0920 commented 1 month ago

补充一点,数据库是MySQL,版本5.7