deltazefiro/DeltaBot

[WinError 2] 系统找不到指定的文件。

gogobody opened this issue · 2 comments

2021-05-12 10:21:08 | INFO | deltabot.plugins.manage_cqhttp:_start_cqhttp - go-cqhttp filename:C:\Users\Administrator\Desktop\DeltaBot-master\deltabot\plugins\../../cqhttp/go-cqhttp-v0.9.40-fix4-windows-amd64.exe
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\quart\asgi.py", line 228, in __call__
    await self.app.startup()
  File "C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\quart\app.py", line 2149, in startup
    await func()
  File "C:\Users\Administrator\Desktop\DeltaBot-master\deltabot\plugins\manage_cqhttp.py", line 143, in main
    _start_cqhttp(p)
  File "C:\Users\Administrator\Desktop\DeltaBot-master\deltabot\plugins\manage_cqhttp.py", line 100, in _start_cqhttp
    subprocess.Popen([f'./{cqhttp_file_name}', 'faststart'], cwd=bpath)
  File "C:\Program Files\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

检查发现路径正确。
单独在 cmd 执行上面路径 C:\Users\Administrator\Desktop\DeltaBot-master\deltabot\plugins../../cqhttp/go-cqhttp-v0.9.40-fix4-windows-amd64.exe 可以执行

    logger.info("Start go-cqhttp!")
    subprocess.Popen([f'./{cqhttp_file_name}', 'faststart'], cwd=bpath)

改为

    logger.info("Start go-cqhttp!")
    subprocess.Popen([f'{cqhttp_path}', 'faststart'], cwd=bpath)

win下解决

感谢您对本项目做出的贡献
已在 ca5f1ed 合并。