Are you running your script from an iCloud or external folder perhaps? That is a common problem , that there are a few threads about. IIRC if you want to run from iCloud, you need to create a sub folder.