Question: Here's the code that I'm trying to run:

```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r

```

Answer: 
I had same issue and kept returning None value.

I did several trials and found the solution for me.
OS : MacOS

I saved photo with my system screenshot tool ( command+shift+5) and saved. it seems it's different pixel info as what it's displayed in my screen.
Therefore I used pyautogui screenshot instead to save the photo which I wanted to.

```
pyautogui.screenshot('num7_.png', region=(260,360, 110, 100))

```

After that, it's working good regardless of grayscale parameter.

```
pyautogui.locateOnScreen('num7_.png')
Box(left=260, top=360, width=110, height=100)

```
If you have taken screenshot with snipping tool it wont work, so take screenshot with "prt sc" or command prompt. This worked for me!