18.04 – Running Python script on WSL causes error due to ^M

Running Ubuntu 18.04 under WSL, I have one .py file that if I do:

$ ls -la foo.py 
-rwxrwxrwx 1 ken ken 6778 Apr 25 15:16 foo.py
$ ./foo.py
bash: ./foo.py: /usr/bin/python3^M: bad interpreter: No such file or directory

If I do the full:

$ python ./foo.py

The script runs as normal. Also, this works:

$ touch bar.py
$ chmod +x bar.py
$ ./bar.py

This happens both in the raw bash shell and the VSCode terminal window. Why might my file cause such an error?