Arduino IDE to Python- problems with the Firmata library

The error you encountered stems from the use of deprecated functions in the inspect module of Python, which causes incompatibility with recent versions of Python and the pyFirmata library.

Specifically here, inspect.getargspec() has been deprecated since Python 3.5 (it was removed in Python 3.11).

if the pyFirmata library still references this function then it's an issue...

One option would be to downgrade your Python version to 3.10 or earlier

Alternatively you could consider using another library like PyMata or pyFirmata2, which should be compatible with newer versions of Python.

(I don't use pyFirmata so I can't really recommend one. If you were willing to develop your own Arduino code and your own python code and get rid of the pyFirmata constraints, I've written a small tutorial on interfacing with Python. See Two ways communication between Python3 and Arduino )