JHue58 / ChatLearning

基于mirai-api-http,让bot学会你的群的说话方式
GNU Affero General Public License v3.0
319 stars 21 forks source link

强制Ctrl c退出后会删除ChatLearning.py文件 #48

Closed greenhandzdl closed 2 years ago

greenhandzdl commented 2 years ago
linux1@gservice:/mirai/develop/ChatLearning_Source$ python3 Chatmain.py
Traceback (most recent call last):
  File "Chatmain.py", line 27, in <module>
    import ChatLearning
ModuleNotFoundError: No module named 'ChatLearning'
JHue58 commented 2 years ago

请检查文件是否完整? 有没有chatlearning.py文件

greenhandzdl commented 2 years ago

存在

greenhandzdl commented 2 years ago

linux1@gservice:/mirai/develop$ tree ChatLearning_Source/
ChatLearning_Source/
├── AutoTask
│   ├── AutoTask.clc
│   └── 看我看我.txt
├── ChatAdmin.py
├── ChatAllfind.py
├── ChatCheck.py
├── ChatClass.py
├── ChatDelete.py
├── ChatFilter.py
├── Chatmain.py
├── ChatMerge.py
├── ChatReply.py
├── ChatSubadmin.py
├── config.clc
├── data.json
├── log.log
├── __pycache__
│   ├── ChatAdmin.cpython-38.pyc
│   ├── ChatAllfind.cpython-38.pyc
│   ├── ChatCheck.cpython-38.pyc
│   ├── ChatClass.cpython-38.pyc
│   ├── ChatDelete.cpython-38.pyc
│   ├── ChatFilter.cpython-38.pyc
│   ├── ChatLearning.cpython-38.pyc
│   ├── ChatMerge.cpython-38.pyc
│   ├── ChatReply.cpython-38.pyc
│   ├── ChatSubadmin.cpython-38.pyc
│   └── simuse.cpython-38.pyc
├── requirements.txt
├── simuse.py
└── WordStock
    └── Merge.cl

3 directories, 29 files
JHue58 commented 2 years ago

存在

是cd到目录后再打开的吗

greenhandzdl commented 2 years ago

对比了下win下的文件解压,发现少了几个文件,抱歉打扰了

JHue58 commented 2 years ago

linux1@gservice:/mirai/develop$ tree ChatLearning_Source/
ChatLearning_Source/
├── AutoTask
│   ├── AutoTask.clc
│   └── 看我看我.txt
├── ChatAdmin.py
├── ChatAllfind.py
├── ChatCheck.py
├── ChatClass.py
├── ChatDelete.py
├── ChatFilter.py
├── Chatmain.py
├── ChatMerge.py
├── ChatReply.py
├── ChatSubadmin.py
├── config.clc
├── data.json
├── log.log
├── __pycache__
│   ├── ChatAdmin.cpython-38.pyc
│   ├── ChatAllfind.cpython-38.pyc
│   ├── ChatCheck.cpython-38.pyc
│   ├── ChatClass.cpython-38.pyc
│   ├── ChatDelete.cpython-38.pyc
│   ├── ChatFilter.cpython-38.pyc
│   ├── ChatLearning.cpython-38.pyc
│   ├── ChatMerge.cpython-38.pyc
│   ├── ChatReply.cpython-38.pyc
│   ├── ChatSubadmin.cpython-38.pyc
│   └── simuse.cpython-38.pyc
├── requirements.txt
├── simuse.py
└── WordStock
    └── Merge.cl

3 directories, 29 files

根目录下缺少了chatlearning.py文件

greenhandzdl commented 2 years ago

···

linux1@gservice:/mirai/develop$ wget https://github.com/Nana-Miko/ChatLearning/releases/download/V2.9.8/ChatLearning.Source.zip --2022-07-22 16:02:42-- https://github.com/Nana-Miko/ChatLearning/releases/download/V2.9.8/ChatLearning.Source.zip Resolving github.com (github.com)... 140.82.112.4 Connecting to github.com (github.com)|140.82.112.4|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/460085014/eea18b2c-8fea-4a79-b2d6-542475c7ea74?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220722%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220722T160242Z&X-Amz-Expires=300&X-Amz-Signature=d85cd72f233c6d8822b4c8eacdb49f03238feb8803cc2a62118cbeaea75404fd&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=460085014&response-content-disposition=attachment%3B%20filename%3DChatLearning.Source.zip&response-content-type=application%2Foctet-stream [following] --2022-07-22 16:02:42-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/460085014/eea18b2c-8fea-4a79-b2d6-542475c7ea74?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220722%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220722T160242Z&X-Amz-Expires=300&X-Amz-Signature=d85cd72f233c6d8822b4c8eacdb49f03238feb8803cc2a62118cbeaea75404fd&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=460085014&response-content-disposition=attachment%3B%20filename%3DChatLearning.Source.zip&response-content-type=application%2Foctet-stream Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ... Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 49701 (49K) [application/octet-stream] Saving to: ‘ChatLearning.Source.zip’

ChatLearning.Source.zip 100%[==============================================================>] 48.54K --.-KB/s in 0.004s

2022-07-22 16:02:42 (12.8 MB/s) - ‘ChatLearning.Source.zip’ saved [49701/49701]

linux1@gservice:/mirai/develop$ unzip ChatLearning.Source.zip Archive: ChatLearning.Source.zip creating: Source/ inflating: Source/ChatAdmin.py inflating: Source/ChatAllfind.py inflating: Source/ChatCheck.py inflating: Source/ChatClass.py inflating: Source/ChatDelete.py inflating: Source/ChatFilter.py inflating: Source/ChatLearning.py inflating: Source/ChatMerge.py inflating: Source/ChatReply.py inflating: Source/ChatSubadmin.py inflating: Source/Chatmain.py inflating: Source/config.clc inflating: Source/data.json inflating: Source/requirements.txt inflating: Source/simuse.py linux1@gservice:/mirai/develop$ cd Source/`

^C linux1@gservice:/mirai/develop$ cd Source/ linux1@gservice:/mirai/develop/Source$ ls ChatAdmin.py ChatCheck.py ChatDelete.py ChatLearning.py ChatMerge.py ChatSubadmin.py data.json simuse.py ChatAllfind.py ChatClass.py ChatFilter.py Chatmain.py ChatReply.py config.clc requirements.txt linux1@gservice:/mirai/develop/Source$ python3 Chatmain.py .p 在目录下的AutoTask文件夹内看看定时任务的说明吧! 正在更新词库版本,270 -> 280 请勿中途退出 正在更新config, -> 280 请勿中途退出 正在更新config, -> 290 请勿中途退出 正在更新config, -> 295 请勿中途退出 正在更新config, -> 297 请勿中途退出 正在更新config, -> 298 请勿中途退出 欢迎使用ChatLearning应用 版本号: 2.9.8 输入help来查看指令列表吧! <function getcommand_chat at 0x3ff998ccee0>:未与api-http取得连接,或mirai未登录 getcommand_chat:正在进行第1次重试 getcommand_chat:正在进行第2次重试 getcommand_chat:正在进行第3次重试 getcommand_chat:正在进行第4次重试 getcommand_chat:正在进行第5次重试 getcommand_chat:正在进行第6次重试 getcommand_chat:正在进行第7次重试 getcommand_chat:正在进行第8次重试 getcommand_chat:正在进行第9次重试 getcommand_chat:正在进行第10次重试 getcommand_chat:正在进行第11次重试 getcommand_chat:正在进行第12次重试 getcommand_chat:正在进行第13次重试 getcommand_chat:正在进行第14次重试 getcommand_chat:正在进行第15次重试 getcommand_chat:正在进行第16次重试 getcommand_chat:正在进行第17次重试 getcommand_chat:正在进行第18次重试

ChatLearning -> ChatLearning控制台无法加载,可能是置于后台运行,或是程序退出 linux1@gservice:/mirai/develop/Source$ cp ../ChatLearning/data.json . linux1@gservice:/mirai/develop/Source$ python3 Chatmain.py Traceback (most recent call last): File "Chatmain.py", line 27, in import ChatLearning ModuleNotFoundError: No module named 'ChatLearning' linux1@gservice:/mirai/develop/Source$ ls AutoTask ChatAllfind.py ChatClass.py ChatFilter.py ChatMerge.py ChatSubadmin.py data.json requirements.txt WordStock ChatAdmin.py ChatCheck.py ChatDelete.py Chatmain.py ChatReply.py config.clc pycache simuse.py linux1@gservice:/mirai/develop/Source$ cd .. linux1@gservice:/mirai/develop$ rm -rf Source/ linux1@gservice:/mirai/develop$ unzip ChatLearning.Source.zip Archive: ChatLearning.Source.zip creating: Source/ inflating: Source/ChatAdmin.py inflating: Source/ChatAllfind.py inflating: Source/ChatCheck.py inflating: Source/ChatClass.py inflating: Source/ChatDelete.py inflating: Source/ChatFilter.py inflating: Source/ChatLearning.py inflating: Source/ChatMerge.py inflating: Source/ChatReply.py inflating: Source/ChatSubadmin.py inflating: Source/Chatmain.py inflating: Source/config.clc inflating: Source/data.json inflating: Source/requirements.txt inflating: Source/simuse.py linux1@gservice:/mirai/develop$ ls Source/ ChatAdmin.py ChatCheck.py ChatDelete.py ChatLearning.py ChatMerge.py ChatSubadmin.py data.json simuse.py ChatAllfind.py ChatClass.py ChatFilter.py Chatmain.py ChatReply.py config.clc requirements.txt linux1@gservice:/mirai/develop$ cp ChatLearning/data.json Source/ linux1@gservice:/mirai/develop$ ls Source/ ChatAdmin.py ChatCheck.py ChatDelete.py ChatLearning.py ChatMerge.py ChatSubadmin.py data.json simuse.py ChatAllfind.py ChatClass.py ChatFilter.py Chatmain.py ChatReply.py config.clc requirements.txt linux1@gservice:/mirai/develop$ python3 Source/Chatmain.py .Source.zi 在目录下的AutoTask文件夹内看看定时任务的说明吧! Traceback (most recent call last): File "Source/Chatmain.py", line 2053, in hello() File "Source/Chatmain.py", line 48, in hello file = open('config.clc', 'r', encoding='utf-8-sig') FileNotFoundError: [Errno 2] No such file or directory: 'config.clc' linux1@gservice:/mirai/develop$ python3 Source/Chatmain.py Traceback (most recent call last): File "Source/Chatmain.py", line 2053, in hello() File "Source/Chatmain.py", line 48, in hello file = open('config.clc', 'r', encoding='utf-8-sig') FileNotFoundError: [Errno 2] No such file or directory: 'config.clc' ··· 我在想是不是cp操作问题,cp之前还能打开的

greenhandzdl commented 2 years ago

还真是cp问题,草

greenhandzdl commented 2 years ago

欸,不对,好像ctrl c强制退出也会挂


linux1@gservice:/mirai/develop/Source$ python3 Chatmain.py
.p
在目录下的AutoTask文件夹内看看定时任务的说明吧!
正在更新词库版本,270 -> 280 请勿中途退出
正在更新config, -> 280 请勿中途退出
正在更新config, -> 290 请勿中途退出
正在更新config, -> 295 请勿中途退出
正在更新config, -> 297 请勿中途退出
正在更新config, -> 298 请勿中途退出
欢迎使用ChatLearning应用 版本号: 2.9.8
输入help来查看指令列表吧!
抛出异常,已记录到日志(log.log文件)
Traceback (most recent call last):
  File "/mirai/develop/Source/ChatClass.py", line 375, in run
    self._target(*self._args, **self._kwargs)
  File "Chatmain.py", line 1854, in getcommand_chat
    message = simuse.Fetch_Message(data)
  File "/mirai/develop/Source/simuse.py", line 89, in Fetch_Message
    Message = res['data']
KeyError: 'data'

ChatLearning ->
ChatLearning控制台无法加载,可能是置于后台运行,或是程序退出
linux1@gservice:/mirai/develop/Source$ ls ../
ChatLearning  ChatLearning.Source.zip  kotlin-mirai-console-reflection  Source
linux1@gservice:/mirai/develop/Source$ python3 Chatmain.py
Traceback (most recent call last):
  File "Chatmain.py", line 27, in <module>
    import ChatLearning
ModuleNotFoundError: No module named 'ChatLearning'
linux1@gservice:/mirai/develop/Source$
JHue58 commented 2 years ago

是不是把data.json覆盖掉了

JHue58 commented 2 years ago

后台运行用screen或者nohup吧,ctrl+c肯定会挂

greenhandzdl commented 2 years ago

我是说ctrl c之后我就打不开了,似乎那个learning文件没了

JHue58 commented 2 years ago

我是说ctrl c之后我就打不开了,似乎那个learning文件没了

这么神奇,我待会试试!

greenhandzdl commented 2 years ago

大概是这样的,可以稳定复现

https://user-images.githubusercontent.com/61241103/180482006-1342cf05-2082-424c-a46f-910b4cb93d74.mp4

JHue58 commented 2 years ago

应该是我之前试着加过一个功能,然后删代码的时候没删干净加上忘记在linux上测试了,马上修

JHue58 commented 2 years ago

修完了,已经把下载源替换掉了

greenhandzdl commented 2 years ago

我在想source跟直接git源码有什么区别

JHue58 commented 2 years ago

我在想source跟直接git源码有什么区别

其实是一样的,但是因为用到了我的cos,所以在仓库里的代码没写上api key