Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Provide a better error message if only weights.yaml is provided with players: 0 #2227

Merged
merged 5 commits into from
Nov 22, 2023

Conversation

remyjette
Copy link
Collaborator

What is this fixing or adding?

A user in the discord had some confusion because they had named their player YAML file weights.yaml. Since this is the generic weights file and the user had not specified the number of players or provided any other files, the number of players was 0. But, since there was a weights file, the if not weights_cache: check did not raise an Exception. It wasn't until checking for slot name uniqueness that things blew up, with a very confusing error.

How was this tested?

Put a weights.yaml in the Players folder and ran Generate.py.

Before:

Archipelago (0.4.3) logging initialized on Linux-6.2.0-1012-azure-x86_64-with-glibc2.35 running Python 3.10.12
Weights: /home/remyjette/Archipelago/Players/weights.yaml >> Simple archipelago game YAML
Generating for 0 player, 19738373992647940205 Seed 79421069723667378462 with plando: bosses
Uncaught exception
Traceback (most recent call last):
  File "/home/remyjette/Archipelago/Generate.py", line 646, in <module>
    main()
  File "/home/remyjette/Archipelago/Generate.py", line 202, in main
    if len(set(name.lower() for name in erargs.name.values())) != len(erargs.name):
AttributeError: 'Namespace' object has no attribute 'name'

After:

Archipelago (0.4.3) logging initialized on Linux-6.2.0-1012-azure-x86_64-with-glibc2.35 running Python 3.10.12
Weights: /home/remyjette/Archipelago/Players/weights.yaml >> Simple archipelago game YAML
Uncaught exception
Traceback (most recent call last):
  File "/home/remyjette/Archipelago/Generate.py", line 651, in <module>
    main()
  File "/home/remyjette/Archipelago/Generate.py", line 132, in main
    raise Exception("No individual player files found and number of players is 0. "
Exception: No individual player files found and number of players is 0. Provide individual player files or specify the number of players via host.yaml or --multi.

@remyjette remyjette changed the title Generate: Provide a better error message if only weights.yaml is provided with players: 0 Core: Provide a better error message if only weights.yaml is provided with players: 0 Sep 26, 2023
@ThePhar ThePhar added affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. labels Oct 17, 2023
Generate.py Outdated Show resolved Hide resolved
@ThePhar ThePhar merged commit af0d47b into ArchipelagoMW:main Nov 22, 2023
12 checks passed
@remyjette remyjette deleted the better-error-message-no-players branch November 22, 2023 17:28
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants