PiDog error when loading

When I try lo execute a script from Thonny (or the Terminal), I get that error when it is a second script that I tried:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gpiozero/pins/pi.py”, line 411, in pin
pin = self.pins[info]
KeyError: PinInfo(number=29, name=‘GPIO5’, names=frozenset({‘BCM5’, 5, ‘J8:29’, ‘GPIO5’, ‘BOARD29’, ‘WPI21’, ‘5’}), pull=‘’, row=15, col=1, interfaces=frozenset({‘’, ‘uart’, ‘spi’, ‘gpio’, ‘dpi’, ‘i2c’}))

During handling of the above exception, another exception occurred:

What could be the problem? Thanks!

It is recommended to provide us with a complete screenshot of the error.
What sample code did you run and what error occurred?
What version of the system are you currently using and what model of Raspberry Pi board are you using? Please tell us so that we can reproduce and solve the problem.
Has the code been modified? Are all modules wired correctly?

Hi,

Here is a screen of the errors. If you need more, please let me know.

I am using 3.11.2 version of Python, on a PC Windows 10 with 32G of memory.

As you could see, I am using Thonny for execution! I also tried by the Terminal, but got the same errors.

Sometimes, when I launch the first script (ex: wake_up) everything seems OK, but when I tried another when I got all these errors!?!

Thank you for your help,

Bernard Mataigne

Sorry, I forgot to send the screenshot… Here it is.

(attachments)

Do not use Raspberry Pi’s built-in programming tools (such as Geany) to run speaker-related scripts. These tools run with standard user privileges, while hardware control (such as managing speakers) usually requires higher privileges.
It is recommended that you execute python code on the command line. When running related scripts, you need to add sudo to obtain administrative privileges. For example, sudo python3 tts.py