Getting a Nil Object when trying to load the variable file

The grandparent directory (/home/ian/Development/My\ Apps/) doesn’t exist. This will cause GetFolderItem to return a Nil folderitem. Calling .Child on the nil folderitem will raise a NilObjectException.

I think the problem is that you’re using backslashes to escape spaces in the path. This isn’t required or supported by GetFolderItem, and so the backslashes are being interpreted as part of the directory name. Try /home/ian/Development/My Apps/Meter Reads.

1 Like

Huh, ok, I guess I am used to using the back slash in bash scripting I just assumed I would have to do it here too. And… hey! That was it! Thank you!!!

Keep in mind that on macOS you can’t rely on GetFolderItem because of permissions. I seriously wish people would forget the function exists.

You also can’t expect to get to SpecialFolder.Documents without permission either.
(also, notably, the right way to do this for Windows)

In both instances the resulting FolderItem ends up nil with no error information.

1 Like