40Cakes / pokebot-gen3

PokéBot Gen3 is a shiny hunting bot, written in Python that runs libmgba + mGBA Python bindings under the hood. Pokémon Ruby, Sapphire, Emerald, FireRed and LeafGreen are supported.
https://www.youtube.com/@40_Cakes/streams
GNU General Public License v3.0
176 stars 53 forks source link

macOS: The program seems to be silently crashing #368

Open ymaniz09 opened 3 weeks ago

ymaniz09 commented 3 weeks ago

I noticed that after a while, the bot stops, and the UI disappears:

Screenshot 2024-08-28 at 18 41 07

I wasn't able to spot anything on the execution logs:

────────────────────────────────────────────────────────────  Misdreavus encountered at Route 117 ────────────────────────────────────────────────────────────
┏━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃            ┃       ┃            ┃            ┃                 ┃                 ┃   Shiny    ┃
┃    PID     ┃ Level ┃    Item    ┃   Nature   ┃     Ability     ┃  Hidden Power   ┃   Value    ┃
┡━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│  FFC7033E  │   5   │     -      │   Quirky   │    Levitate     │   Grass (59)    │   63,315   │
└────────────┴───────┴────────────┴────────────┴─────────────────┴─────────────────┴────────────┘
                 Misdreavus IVs
┏━━━━┳━━━━━┳━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━┳━━━━━━━┓
┃ HP ┃ ATK ┃ DEF ┃ SPATK ┃ SPDEF ┃ SPD ┃ Total ┃
┡━━━━╇━━━━━╇━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━╇━━━━━━━┩
│ 3  │ 31  │ 30  │   8   │  31   │ 31  │   134 │
└────┴─────┴─────┴───────┴───────┴─────┴───────┘
                                                  Statistics
┏━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃            ┃  Phase IV  ┃    Phase SV     ┃      Phase ┃            ┃      Shiny ┃      Total ┃      Shiny ┃
┃            ┃  Records   ┃     Records     ┃ Encounters ┃    Phase % ┃ Encounters ┃ Encounters ┃    Average ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ Misdreavus │  45 / 183  │   23 / 65,519   │      3,632 │     99.92% │          0 │      3,632 │        N/A │
│ Sableye    │ 102 / 170  │ 5,541 / 32,260  │          3 │      0.08% │          1 │      1,668 │    1/1,668 │
│ Total      │  45 / 183  │   23 / 65,519   │      3,635 │       100% │         97 │    706,750 │    1/7,286 │
└────────────┴────────────┴─────────────────┴────────────┴────────────┴────────────┴────────────┴────────────┘

Please let me know if/how I can provide more meaningful information about this issue =]

wutkaru commented 3 weeks ago

Could you provide for more information ?

I try to run install and just customize script requirements.py on my MacBook that throw error in ttkthemes~=3.2.2

 import _tkinter # If this fails your Python may not be configured for Tk
          ^^^^^^^^^^^^^^^
      ModuleNotFoundError: No module named '_tkinter'
ymaniz09 commented 3 weeks ago

I created a venv for Python 3.12.4, and after activating it, I just ran python pokebot.py.. I haven't interacted directly with requirements.py.

Usually, it works as expected: Screenshot 2024-08-29 at 11 03 11

The bot usually works as expected for a few hours. From time to time, I notice the blank screenshot that I attached above.

macOS: Sonama Chip: M1

wutkaru commented 3 weeks ago

Thank for information Update after using venv and ran pokebot.py

subprocess.CalledProcessError: Command '['/Users/wukaru/venv/bin/python3', '-m', 'pip', 'install', '--disable-pip-version-check', '--no-python-version-warning', 'ttkthemes~=3.2.2']' returned non-zero exit status 1.

Error in ttkthemes module when try to install maybe same as before I was found

wutkaru commented 3 weeks ago

@ymaniz09 After I was setup env path then I can run bot on MacOS

image

Now testing if I found some as you found this issue will update later

ymaniz09 commented 3 weeks ago

Thank you!

I'm running four bots here in parallel: Screenshot 2024-08-29 at 15 25 01

It takes a while, but usually, it's easy to reproduce.

(I never spotted it on Windows, so I'm suspecting it might be related to generating the notification when the bot finds a target)

hanzi commented 3 weeks ago

If you suspect that it's due to desktop notifications, you can disable those by editing profiles/logging.yml.

Find the line that says

desktop_notifications: true

and change it to

desktop_notifications: false
ymaniz09 commented 3 weeks ago

I beleive we are in a good direction: