Kilvoctu / aiyabot

A neat Discord bot for AUTOMATIC1111's Web UI
GNU General Public License v2.0
309 stars 76 forks source link

Aiybot closes just as SD boots up #199

Closed Gecktendo closed 1 year ago

Gecktendo commented 1 year ago

Describe the bug
I'm running automatic, build 20ae71faa8ef035c31aa3a410b707d792c8203a3 as recommended in your readme. Aiyabot is updated to the most recent version. I have successfully ran aiybot in the past many times, but the most recent version closes the terminal window almost immediately after SD boots up. I've had this problem for weeks unfortunately.


Environment


Console logs
Unfortunately the terminal window closes too quickly for me to be able to copy paste the error log.

solareon commented 1 year ago

@Gecktendo Can you try opening a terminal window in the folder and running the launch.bat from there to see what error comes out?

Gecktendo commented 1 year ago

Traceback (most recent call last): File "D:\ProgramData\aiyabot\aiya.py", line 22, in settings.files_check() File "D:\ProgramData\aiyabot\core\settings.py", line 420, in files_check message_data = list(csv.reader(csv_file, delimiter='|')) File "D:\ProgramData\anaconda3\lib\codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 193: invalid start byte

solareon commented 1 year ago

If you open the batch file in a text file and paste the commands 1 by 1 into a terminal window that is in the Aiyabot folder which one throws the error?. Also can you paste me the path that you are running the launch.bat from?

Gecktendo commented 1 year ago

"venv\Scripts\python.exe aiya.py" is the program/line throwing the error.

I'm running the program from the directory: "D:\ProgramData\aiyabot"

solareon commented 1 year ago

Okay can you run the following command

python --version or python3 --version

And do you have python installed natively or is it being provided via anaconda?

Gecktendo commented 1 year ago

I had to run "python --version" and it gave me:

Python 3.10.9

I'm running python through anaconda.

solareon commented 1 year ago

Okay I think that might be the issue. Try doing the following to create a conda environment for aiyabot and install the reqs. This should all be run from the folder Aiyabot is in.

conda create --name aiyabot python=3.10.12 anaconda
conda install --name aiyabot --yes --file requirements.txt

Then modify the launch.bat as follows

conda activate aiyabot
python core/setup_generate.py
python aiya.py

Note that anaconda is not really a recommended way to run Aiyabot as it expects a native python installation. The above code should work but no guarantees

Gecktendo commented 1 year ago

Hi, sorry for the delayed response, I wanted to test some things.

First, I installed python natively. I'm using 3.10.11 because I couldn't get 3.10.12 working. I'm hoping it's close enough.

Second, I uninstalled anaconda since I really wasn't using it. I reinstalled automatic1111 and aiyabot using the python 3.10.11. Attempting to run it this way results in the same issues I mentioned at the top of the page: the program closes as soon as auto1111 boots up.

I know it's not quite the same way you described but after looking at the original code in the launch.bat file I think it wasn't necessary to change this now that I'm running python natively.

solareon commented 1 year ago

That's correct if you are running python natively then you can go back to the original launch.bat and not the modified one I posted above. Can you try deleting all the files in the resources folder and then redownloading messages.csv into that folder? That's really the only thing that points towards the errors for loading for a decode error. Everything else aiyabot does is handled either in discord, in memory, or created afterwards when it joins a channel.

Gecktendo commented 1 year ago

I deleted everything in the resources folder and redownloaded the messages.csv file. This seems to have fixed the problem somehow. Looks like I can close this bug report.