
You cannot use a NamedTempFile with an external process because it may not be flushed to disk. The safest and most portable approach is to close the file, call the other process and then unlink the file manually. Presumably this works fine on Linux, but it fails on Darwin when targeting remote-linux. See https://bugs.python.org/issue29573