I was playing around with crontabs and duplicity today on OS X 10.5 Leopard. I’d written a python script that executes duplicity, my script ran just fine from the shell, but churned out the following cryptic error message when run from crontab:
...
Cleanup of temporary directory /var/folders/7Q/7Qlu3ZqFHeuxCbNgaimO2E+++TI/-Tmp-/duplicity-ben2Y6-tempdir
failed - this is probably a bug.
Traceback (most recent call last):
File "/opt/local/bin/duplicity", line 553, in <module>
with_tempdir(main)
File "/opt/local/bin/duplicity", line 547, in with_tempdir
fn()
File "/opt/local/bin/duplicity", line 528, in main
full_backup(col_stats)
File "/opt/local/bin/duplicity", line 225, in full_backup
sig_outfp = get_sig_fileobj("full-sig")
File "/opt/local/bin/duplicity", line 203, in get_sig_fileobj
fh = globals.backend.get_fileobj_write(sig_filename)
File "/opt/local/lib/python2.5/site-packages/duplicity/backend.py", line 341, in get_fileobj_write
fh = dup_temp.FileobjHooked(tdp.filtered_open("wb"))
File "/opt/local/lib/python2.5/site-packages/duplicity/path.py", line 644, in filtered_open
elif mode == "wb": return gpg.GPGFile(1, self, gpg_profile)
File "/opt/local/lib/python2.5/site-packages/duplicity/gpg.py", line 105, in __init__
'logger': self.logger_fp})
File "/opt/local/lib/python2.5/site-packages/GnuPGInterface.py", line 357, in run
create_fhs, attach_fhs)
File "/opt/local/lib/python2.5/site-packages/GnuPGInterface.py", line 401, in _attach_fork_exec
if process.pid == 0: self._as_child(process, gnupg_commands, args)
File "/opt/local/lib/python2.5/site-packages/GnuPGInterface.py", line 442, in _as_child
os.execvp( command[0], command )
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.py", line 353, in execvp
_execvpe(file, args)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/os.py", line 389, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
...
It turned out the underlying problem was that gnupg was installed via Mac Ports which installs into a directory that’s not in PATH by default. Adding /opt/local/bin to PATH got things working.
The “Cleanup of temporary directory bla failed - this is probably a bug” message is kind of misleading…