I've written a couple of scripts that I want to run automatically on my computer, so I've added the line #! Applications/anaconda/bin/python
to the beginning of each script to made it executable. Oddly enough, one of the programs worked perfectly after adding that line and then running chmod +x \path\to\program.py
in the terminal. But for the second program I followed the same process but when I try and run the script from the terminal using \path\to\program.py
I get an error which reads:
Applications/anaconda/bin/python^M: bad interpreter: No such file or directory
. I understand that this means that I have a carriage return on the end of the line that's throwing it off, but I don't understand how to get rid of it. Here are the snippets from my two scripts, this one works:
#! /Applications/anaconda/bin/python
import time
from selenium import webdriver
import easygui
.
.
.
And this one doesn't:
#! Applications/anaconda/bin/python
from datetime import datetime
import calendar
.
.
.