Skip to content

Solitare example script hits exception for "Sprite is already in the list"  #951

@mriswithe

Description

@mriswithe

Bug Report

Copy/pasted https://api.arcade.academy/en/latest/tutorials/card_game/solitaire_11.html#solitaire-11 into a file (opus_solitaire.py)
When run, I get an exception. Works with Arcade 2.5.7, but 2.6.0 and 2.6.1 both break on the same error shown below in actual behavior. Actual index position is different every run since it is part of the shuffling that is going wrong here.

Tested with:

OS: Windows 10
Arcade:

  • 2.6.1
  • 2.6.0
  • 2.5.7 (This works)

Python:

  • 3.9.7
  • 3.8.6

Actual behavior:

C:\Users\veigar\PycharmProjects\opus_solitare\venv_38\Scripts\python.exe C:/Users/veigar/PycharmProjects/opus_solitare/opus_solitaire.py
Traceback (most recent call last):
  File "C:/Users/veigar/PycharmProjects/opus_solitare/opus_solitaire.py", line 412, in <module>
    main()
  File "C:/Users/veigar/PycharmProjects/opus_solitare/opus_solitaire.py", line 407, in main
    window.setup()
  File "C:/Users/veigar/PycharmProjects/opus_solitare/opus_solitaire.py", line 181, in setup
    self.card_list[pos1], self.card_list[pos2] = self.card_list[pos2], \
  File "C:\Users\veigar\PycharmProjects\opus_solitare\venv_38\lib\site-packages\arcade\sprite_list\sprite_list.py", line 208, in __setitem__
    raise Exception(f"Sprite is already in the list (index {existing_index})")
Exception: Sprite is already in the list (index 23)

Process finished with exit code 1

Expected behavior:

Solitaire game runs

Steps to reproduce/example code:

Windows 10 (May not be necessary but didn't check it out on Linux/Mac)
Python 3.9.7
pip install arcade==2.6.1 # Or 2.6.0
Copy the Solitaire example to your machine
Execute it
Receive stacktrace

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions