清除缓存报错:目标为一个文件夹
Lc113 opened this issue · 2 comments
Lc113 commented
lgc2333 commented
可以给下完整报错堆栈吗
Lc113 commented
08-07 13:10:07 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_bawiki.command.clear_cache) failed.
Traceback (most recent call last):
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot/message.py", line 467, in check_and_run_matcher
await _run_matcher(
└ <function _run_matcher at 0x7fe2aecac820>
> File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot/message.py", line 419, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
│ │ │ │ │ │ └ {<function _command at 0x7fe2af298550>: <Task finished name='Task-2378868' coro=<_command() done, defined at /data/Bot/Rainy/...
│ │ │ │ │ └ <contextlib.AsyncExitStack object at 0x7fe27e4fc4c0>
│ │ │ │ └ {'_prefix': {'command': ('ba清除缓存',), 'raw_command': 'ba清除缓存', 'command_arg': [], 'command_start': '', 'command_whitespace': N...
│ │ │ └ PrivateMessageEvent(time=1691385006, self_id=--BOTQQ号--, post_type='message', sub_type='friend', user_id=--我的QQ号--, message_...
│ │ └ Bot(type='OneBot V11', self_id='--BOTQQ号--')
│ └ <function Matcher.run at 0x7fe2af298160>
└ Matcher(type='message', module=nonebot_plugin_bawiki.command.clear_cache)
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 759, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
│ │ │ │ │ │ └ {<function _command at 0x7fe2af298550>: <Task finished name='Task-2378868' coro=<_command() done, defined at /data/Bot/Rainy/...
│ │ │ │ │ └ <contextlib.AsyncExitStack object at 0x7fe27e4fc4c0>
│ │ │ │ └ {'_prefix': {'command': ('ba清除缓存',), 'raw_command': 'ba清除缓存', 'command_arg': [], 'command_start': '', 'command_whitespace': N...
│ │ │ └ PrivateMessageEvent(time=1691385006, self_id=--BOTQQ号--, post_type='message', sub_type='friend', user_id=--我的QQ号--, message_...
│ │ └ Bot(type='OneBot V11', self_id='--BOTQQ号--')
│ └ <function Matcher.simple_run at 0x7fe2af2980d0>
└ Matcher(type='message', module=nonebot_plugin_bawiki.command.clear_cache)
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 734, in simple_run
await handler(
└ Dependent(call=_)
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
│ │ │ │ │ │ └ {'matcher': Matcher(type='message', module=nonebot_plugin_bawiki.command.clear_cache)}
│ │ │ │ │ └ <function _ at 0x7fe2961cab90>
│ │ │ │ └ Dependent(call=_)
│ │ │ └ ~R
│ │ └ typing.Awaitable
│ └ typing.Callable
└ <function cast at 0x7fe2b1e5f010>
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/nonebot_plugin_bawiki/command/clear_cache.py", line 41, in _
await path.unlink() if path.is_file() else shutil.rmtree(path)
│ │ │ │ │ │ └ Path('/data/Bot/Rainy/data/BAWiki/cache/arona')
│ │ │ │ │ └ <function rmtree at 0x7fe2b3585ab0>
│ │ │ │ └ <module 'shutil' from '/usr/local/python3/lib/python3.10/shutil.py'>
│ │ │ └ <function Path.is_file at 0x7fe2adfa8160>
│ │ └ Path('/data/Bot/Rainy/data/BAWiki/cache/arona')
│ └ <function Path.unlink at 0x7fe2adfa8f70>
└ Path('/data/Bot/Rainy/data/BAWiki/cache/arona')
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/anyio/_core/_fileio.py", line 569, in unlink
await to_thread.run_sync(self._path.unlink)
│ │ │ └ <member '_path' of 'Path' objects>
│ │ └ Path('/data/Bot/Rainy/data/BAWiki/cache/arona')
│ └ <function run_sync at 0x7fe2ae33d480>
└ <module 'anyio.to_thread' from '/data/Bot/Rainy/.venv/lib/python3.10/site-packages/anyio/to_thread.py'>
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
└ <function get_asynclib at 0x7fe2ae33cca0>
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
└ <Future finished exception=IsADirectoryError(21, 'Is a directory')>
File "/data/Bot/Rainy/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ <bound method Path.unlink of PosixPath('/data/Bot/Rainy/data/BAWiki/cache/arona')>
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x7fe25d43c040>
File "/usr/local/python3/lib/python3.10/pathlib.py", line 1204, in unlink
self._accessor.unlink(self)
│ │ │ └ PosixPath('/data/Bot/Rainy/data/BAWiki/cache/arona')
│ │ └ <built-in function unlink>
│ └ <pathlib._NormalAccessor object at 0x7fe2b3f3f5e0>
└ PosixPath('/data/Bot/Rainy/data/BAWiki/cache/arona')
IsADirectoryError: [Errno 21] Is a directory: '/data/Bot/Rainy/data/BAWiki/cache/arona'
QQ账号信息手动屏蔽