FengLiuFeseliud / pycqBot

go-cqhttp python 框架,可以用于快速塔建 bot
https://fengliufeseliud.github.io/pycqBot/
GNU Affero General Public License v3.0
128 stars 29 forks source link

文档可否详细点? #16

Closed rhymed-l closed 1 year ago

rhymed-l commented 1 year ago

from pycqBot.cqApi import cqHttpApi, cqLog

启用日志 默认日志等级 DEBUG

cqLog()

cqapi = cqHttpApi() bot = cqapi.create_bot() bot.start()

成功启动可以使用 指令标识符+help 使用内置指令 help

按照官方文档进行了这步操作 然后仔细看文档说需要go-cqhttp文件拷贝到当前目录下,拷贝后需要文件夹名字不 我都试了都是同一个错误

image

运行报错 /Users/rhymed/PycharmProjects/qqBot/venv/bin/python /Users/rhymed/PycharmProjects/qqBot/main.py [2023-04-11 17:43:24,481][MainThread/DEBUG] PyCqBot: Using selector: KqueueSelector Exception in thread cqhttp_shell: Traceback (most recent call last): File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/Users/rhymed/PycharmProjects/qqBot/venv/lib/python3.8/site-packages/pycqBot/socketApp.py", line 221, in cqhttp_start shell_msg = subp.stdout.readline().decode("utf-8").strip() UnboundLocalError: local variable 'subp' referenced before assignment

################################################################# ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝ ██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║
██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║
██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║
╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝
v0.4.4.1 BY FengLiu #################################################################

Traceback (most recent call last): File "/Users/rhymed/PycharmProjects/qqBot/main.py", line 8, in bot.start() File "/Users/rhymed/PycharmProjects/qqBot/venv/lib/python3.8/site-packages/pycqBot/socketApp.py", line 242, in start time.sleep(0.5) KeyboardInterrupt

FengLiuFeseliud commented 1 year ago

默认设置请将 go-cqhttp 放在 入口文件 即运行 bot.start() 的文件同目录

SydrrO commented 1 year ago

默认设置请将 go-cqhttp 放在 入口文件 即运行 bot.start() 的文件同目录

这种方法有些人是不行的,得进入源代码直接改路径

Kevin-free commented 1 year ago

遇到同样问题,还没有解决。请问大佬们,应该怎么办? python3 qqbot.py 当前进程pid: 90804

################################################################# ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝ ██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║
██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║
██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║
╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝
v0.5.1.1 BY FengLiu #################################################################

Exception in thread go-cqhttp: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 980, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 917, in run self._target(*self._args, **self._kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pycqBot/cqHttpApi.py", line 335, in cqhttp_start shell_msg = subp.stdout.readline().decode("utf-8").strip() UnboundLocalError: local variable 'subp' referenced before assignment

Kevin-free commented 1 year ago

遇到同样问题,还没有解决。请问大佬们,应该怎么办? python3 qqbot.py 当前进程pid: 90804

################################################################# ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝ ██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║ ██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║ ██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║ ╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝ v0.5.1.1 BY FengLiu #################################################################

Exception in thread go-cqhttp: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 980, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 917, in run self._target(*self._args, **self._kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pycqBot/cqHttpApi.py", line 335, in cqhttp_start shell_msg = subp.stdout.readline().decode("utf-8").strip() UnboundLocalError: local variable 'subp' referenced before assignment

@rhymed-l @FengLiuFeseliud @Sydrr0

SydrrO commented 1 year ago

遇到同样问题,还没有解决。请问大佬们,应该怎么办? python3 qqbot.py 当前进程pid: 90804 ################################################################# ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██████╗ ████████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██╔═══██╗██╔══██╗██╔═══██╗╚══██╔══╝ ██████╔╝ ╚████╔╝ ██║ ██║ ██║██████╔╝██║ ██║ ██║ ██╔═══╝ ╚██╔╝ ██║ ██║▄▄ ██║██╔══██╗██║ ██║ ██║ ██║ ██║ ╚██████╗╚██████╔╝██████╔╝╚██████╔╝ ██║ ╚═╝ ╚═╝ ╚═════╝ ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝ v0.5.1.1 BY FengLiu ################################################################# Exception in thread go-cqhttp: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 980, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 917, in run self._target(*self._args, **self._kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pycqBot/cqHttpApi.py", line 335, in cqhttp_start shell_msg = subp.stdout.readline().decode("utf-8").strip() UnboundLocalError: local variable 'subp' referenced before assignment

@rhymed-l @FengLiuFeseliud @Sydrr0

直接ctrl点start,然后改路径,改成你现在的完整路径,而不是./