From my understanding it could be because python isn't being recognised or the Path being incorrect. Maybe use this thread to follow a reinstall and see if that is able to fix the problem.
Majority of the time when I have an issue similar to this my PATH environment variable was not including the correct python version but VS code was seeing it was installed and hence made it difficult for me to diagnose.
Also, it looks like the shebang for the un-recognised file is stating just python in the path #!usr/bin/python
. I believe Linux with python3.x
installations has a python3
bin folder name instead so check where that python version is installed and see if that's correct. As far as I know there is a difference between both of these. Does it use the same shebang as the file that is working?