nonebot / nb-cli

NoneBot2 脚手架 / CLI for NoneBot2
https://cli.nonebot.dev
MIT License
154 stars 17 forks source link

卸载apscheduler会报错 #67

Closed YouYouLip closed 1 year ago

YouYouLip commented 1 year ago

仅仅只有apscheduler会这样 可以通过nb安装但是不能nb卸载会报错

Traceback (most recent call last):
File "C:\Program Files\Python310\lib\runpy.py", line 196, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Program Files\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "c:\users\asus.local\bin\nb.exe_main.py", line 7, in
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli_main.py", line 7, in main
anyio.run(cli_main, *args)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_core_eventloop.py", line 70, in run
return asynclib.run(func, *args, **backend_options)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_backends_asyncio.py", line 292, in run
return native_run(wrapper(), debug=debug)
File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_backends_asyncio.py", line 287, in wrapper
return await func(*args)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli_init.py", line 35, in cli_main
return await run_sync(cli_sync)(*args, **kwargs)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli\cli\utils.py", line 61, in wrapper
return await anyio.to_thread.run_sync(partial(func, *args, **kwargs))
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\click\decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli\cli\utils.py", line 69, in wrapper
return anyio.from_thread.run(partial(func, *args, **kwargs))
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio\from_thread.py", line 49, in run
return asynclib.run_async_from_thread(func, *args)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\anyio_backends_asyncio.py", line 970, in run_async_from_thread
return f.result()
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Program Files\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli\cli\commands\plugin.py", line 187, in uninstall
GLOBAL_CONFIG.remove_plugin(plugin.module_name)
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\nb_cli\config\parser.py", line 80, in remove_plugin
plugins.remove(plugin)
File "C:\Program Files\Python310\lib_collections_abc.py", line 1163, in remove
del self[self.index(value)]
File "C:\Users\ASUS.local\pipx\venvs\nb-cli\lib\site-packages\tomlkit\items.py", line 1402, in delitem
and "\n" not in self._value[idx].indent.s
AttributeError: 'NoneType' object has no attribute 's'
yanyongyu commented 1 year ago

这个报错是tomlkit产生的,看上去是tomlkit的问题。看下tomlkit的版本,nb self list。顺便看下你的pyproject.toml文件

YouYouLip commented 1 year ago

anyio 3.6.2 arrow 1.2.3 binaryornot 0.4.4 cashews 5.2.0 certifi 2022.12.7 chardet 5.1.0 charset-normalizer 3.0.1 click 8.1.3 colorama 0.4.6 cookiecutter 2.1.1 distlib 0.3.6 filelock 3.9.0 h11 0.14.0 httpcore 0.16.3 httpx 0.23.3 idna 3.4 Jinja2 3.1.2 jinja2-time 0.2.0 markdown-it-py 2.1.0 MarkupSafe 2.1.2 mdurl 0.1.2 nb-cli 1.0.4 nb-cli-plugin-littlepaimon 1.0.0 noneprompt 0.1.7 pip 22.2.2 platformdirs 2.6.2 prompt-toolkit 3.0.36 py-cpuinfo 9.0.0 pydantic 1.10.4 pyfiglet 0.8.post1 Pygments 2.14.0 python-dateutil 2.8.2 python-slugify 8.0.0 PyYAML 6.0 requests 2.28.2 rfc3986 1.5.0 rich 13.3.1 setuptools 63.2.0 six 1.16.0 sniffio 1.3.0 text-unidecode 1.3

tomlkit 0.11.6

typing_extensions 4.4.0 urllib3 1.26.14 virtualenv 20.17.1 watchfiles 0.18.1 wcwidth 0.2.6

YouYouLip commented 1 year ago

这个报错是tomlkit产生的,看上去是tomlkit的问题。看下tomlkit的版本,。顺便看下你的pyproject.toml文件nb self list

这个是pyproject.toml 有点搞不太懂 可以在nb安装不能在nb卸载

[tool.poetry.dependencies]
python = "^3.8"
nonebot2 = {extras = ["fastapi"], version = "^2.0.0-rc.2"}
nonebot-adapter-onebot = "^2.1"
beautifulsoup4 = "^4.10.0"
httpx = "^0.23.0"
lxml = "^4.8.0"
Pillow = "^9.1.0"
matplotlib = "^3.5.1"
tortoise-orm = "^0.19.2"
tqdm = "^4.64.0"
"ruamel.yaml" = "^0.17.21"
ujson = "^5.4.0"
expandvars = "^0.9.0"
jieba = "^0.42.1"
scipy = "^1.9.1"
scikit-learn = "^1.1.2"
shapely = "^1.8.4"
gitpython = "^3.1.27"
pypinyin = "^0.47.1"
python-jose = "^3.3.0"
amis-python = "^1.0.5"
psutil = "^5.9.3"
nonebot-plugin-apscheduler = "^0.2.0"
playwright = "^1.27.1"
qrcode = "^7.3.1"

[tool.poetry.dev-dependencies]
nb-cli = "^0.6.7"

[tool.nonebot]
plugins = ["nonebot_plugin_apscheduler","nonebot_plugin_heweather", "nonebot_plugin_epicfree", "nonebot_plugin_simplemusic", "nonebot_plugin_petpet", "nonebot_plugin_admin", "nonebot_plugin_tarot", "nonebot_plugin_bilibilibot", "nonebot_plugin_bilicover", "nonebot_plugin_setu4", "nonebot_plugin_gsmaterial", "nonebot_plugin_gspanel", "nonebot_plugin_mystool", "nonebot_plugin_picstatus", "nonebot-plugin-bilibili-image", "nonebot_plugin_note", "nonebot_plugin_sky", "nonebot_plugin_bfchat", "nonebot_plugin_couplets", "nonebot_plugin_b23", "nonebot_plugin_drawer", "nonebot_plugin_htmlrender", "nonebot_plugin_easy_translate", "nonebot_plugin_report_manager", "nonebot_plugin_bawiki", "nonebot_plugin_pixiv", "nonebot_plugin_gscode", "nonebot_plugin_remake", "nonebot_plugin_chatgpt", "nonebot_plugin_bing_chat", "nonebot_plugin_warframe_mode", "nonebot_plugin_word_bank2", "nonebot_plugin_imageutils"]
plugin_dirs = ["src/plugins"]

[build-system]
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
YouYouLip commented 1 year ago

这个报错是tomlkit产生的,看上去是tomlkit的问题。看下tomlkit的版本,nb self list。顺便看下你的pyproject.toml文件

一时分不清是什么问题了 pipx uninstall nb-cli 再pipx重新安装nb后还是不行(挠头)

yanyongyu commented 1 year ago

看上去是tomlkit的bug,你可以尝试在"nonebot_plugin_apscheduler",后面加个空格或者换行?

YouYouLip commented 1 year ago

看上去是tomlkit的bug,你可以尝试在"nonebot_plugin_apscheduler",后面加个空格或者换行?

不好使(悲)貌似是检测到关于apscheduler就这样 nb plugin uninstall aps或者nb plugin uninstall cheduler也会报这种错

yanyongyu commented 1 year ago

报错是tomlkit无法从pyproject.toml里删除"nonebot_plugin_apscheduler",和nb命令无关

YouYouLip commented 1 year ago

报错是tomlkit无法从pyproject.toml里删除"nonebot_plugin_apscheduler",和nb命令无关

惊 试了一下 把aps在pyproject.toml里删除了再卸载确实可以了 but....为什么只有apscheduler会这样(有点疑惑)

yanyongyu commented 1 year ago

格式问题 触发了某些神秘bug 所以我说让你后面加个空格试试

YouYouLip commented 1 year ago

格式问题 触发了某些神秘bug 所以我说让你后面加个空格试试

问题解决了 感谢 不然我可能一辈子被蒙在鼓里了(气) 居然还有一些奇奇怪怪的这种bug