It would be good to catch an <code>os.Error</code> here.  Also, maybe use <code>os.makedirs()</code> instead, just on the off-chance <code>tmp_dir</code> is several non-existent directories deep.