I'm having trouble with file paths again, has something changed with OS10.12.2 ?
I've fooled with discovered educational "FilePathExtractor.fmp12" without realizing problem.
# this insert works fine
go to field (container)
insert pdf (file select dialog)
with the script below PDF is created but insert fails ?
I have tried setting $thepath to simplistic name with no white space or odd chars.