fga401 / AutoTableTurf

Automate the Tableturf game helping you reach Level 999 and get all sleeves.
GNU General Public License v3.0
47 stars 5 forks source link

Error reporting in data.py #2

Closed MegaBlaziken closed 1 year ago

MegaBlaziken commented 1 year ago

Hi fga401. I don't know if this qualifies as a bug report, but could you please check the following error? Environment: ubuntu 20.04.6 LTS bluetooth adapter: ASUS BT-400 (https://github.com/Poohl/joycontrol/issues/5) We have confirmed that it works with the original NXBT. Check the operation of nxbt_server of this program, and jump to the URL displayed, it shows "ok". When running flask run -h 0.0.0.0 in AutoTableTurf directory,

data.py, line 48
tasks: list[Task]
TypeError: 'type' object is not subscriptable

is displayed.

I remember seeing you running this on bilibili before, and I thought it was a problem with our environment, but I couldn't see any improvement, so I decided to post an issue.

If you have time, please check it out.

ghost commented 1 year ago

That seems to be a Python syntax feature that was introduced in Python 3.9: https://peps.python.org/pep-0585/

Perhaps you are using an old version of Python.

MegaBlaziken commented 1 year ago

Yes, ubuntu 20.04.6 LTS defaulted to python 3.8, which is why you got that error. Thank you.

However, after reinstalling ubuntu, dbus-python fails to install when python is set to 3.9 or 3.10.

What environment are you assuming it is supposed to run in? Or do you want to install a different library?

ghost commented 1 year ago

In that case, you should keep your system version of Python as Python 3.8, but you can still install another version of Python in addition to the system version of Python and use it specifically to run this program:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo add-apt-repository universe
sudo apt install python3.9 python3-pip git
git clone https://github.com/fga401/AutoTableTurf
cd AutoTableTurf
python3.9 -m pip install -r requirements.txt
FLASK_APP=portal python3.9 -m flask run -h 0.0.0.0
MegaBlaziken commented 1 year ago

Thank you, I initialized ubuntu today and reinstalled ubuntu 20.04.6. After that, I was able to confirm that they work. (I just did it by giving sudo to install requirements.txt. No particular reason.) However, I could not configure the controller. Specifically,

cd AutoTableTurf
cd controller 
cd nxbt_server
sudo python3.9 -m pip install -r requirement.txt
error: psutil (setup.py), evdev(setup.py)
-> sudo python3.9 -m pip install psutil evdev
->Success
sudo python3.9 -m flask run --host=0.0.0.0
error: No module named '_dbus_bindings'

Here is what I tried

sudo apt-get install python3-dbus
sudo apt install build-essential libdbus-glib-1-dev libgirepository1.0-dev
sudo python3.9 -m pip install dbus-next
sudo python3.9 -m pip install dbus-python
sudo apt install git python3-pip python3-dbus libhidapi-hidraw0 libbluetooth-dev bluez -y

I understand that some packages are duplicates, but I tried everything I could find on the net, assuming that duplicates would be skipped anyway. However, the dbus_bindings error persists.

ghost commented 1 year ago

You have to install dbus-python specifically for Python 3.9 by using --force, otherwise it'll just try (and fail, because dbus-python only works with the specific version of Python that it was installed with) to use the version of dbus-python that your operating system has installed by default for Python 3.8:

sudo apt install python3.9-dev build-essential libdbus-1-dev libglib2.0-dev
sudo python3.9 -m pip install --force dbus-python

Anyways, if this still doesn't work, you could also try running AutoTableTurf with Python 3.8. It should work with Python 3.8 if you insert this line at the very beginning of the files that give you a TypeError: 'type' object is not subscriptable error:

from __future__ import annotations

However, modifying the files will make it difficult to update AutoTableTurf, so I recommend it only as a last resort.

MegaBlaziken commented 1 year ago

I was able to get it to work thanks to your advice, thank you! However, the cheap capture board kept trying to place the card again even where it was placed, probably due to different parameters, so an adjustment or a re-purchase of the capture board was necessary for me😂 I'll try to find it by hand, thanks~!