<br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Can you post the Python script?</blockquote><div><br>Not the whole thing; it's quite long.  But here's the relevant parts.  We're using the ado database interface into postgres (that's what the 
results.EOF is all about)<br><br></div>output_file = file(output_path, 'w')   # output_path = /my_path/data/work/my_file.txt<br>while not results.EOF:<br><div style="margin-left: 40px;">row = results.GetRowAssoc(upper=0)
<br>output_file.write(row['data'])<br>results.MoveNext()<br></div>output_file.close()<br>debug('Total Bytes Written: %d' % total_bytes)<br><br>new_path = None<br>if total_bytes > 0:   new_path = output_path.replace('/work/', '/') 
<br>else:                     new_path = output_path.replace('/work/', '/empty/') <br><br>debug('Original Path [%s]'%output_path)    # new_path = /my_path/data/my_file.txt<br>debug('     New Path [%s]'%new_path)      # new_path = /my_path/data/empty/my_file.txt
<br><br><br>The original code looked like this (worked from command line, failed with cron) <br><br>os.rename(output_path, new_path)<br><br>But since that didn't work and I could create a new file, I tried this as a work around
<br><br>output_file = file(new_path, 'w')<br>for line in file(output_path):<br><div style="margin-left: 40px;">output_file.write(line)<br></div>output_file.close()<br><br>The interesting/infuriating thing is that the second method also fails; that is, the file is not moved to the data directory or the "empty" directory...it remains in the "work" directory after the cron job completes.  If I run the same routine from the command like (after su'ing to the edith user) it runs and moves the file to the appropriate directory.
<br><br>I am going to see if we can get the email routing set up (we run over 100 cron jobs daily so I'm not sure I want it on too long) to see if it will tell me anything.<br><br><br>Thanks for your time and effort<br>
--greg<br><br><br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">What's the name of the original file, and what are you trying to rename
<br>it to? I'm wondering if you are deriving the new name from something,<br>and that thing is failing from within the cronjob for some reason.<br>Perhaps the new name contains a complete path in one of the cases but<br>
not in the other...<br><br>Edith should be getting email (if email routing is set up correctly) if<br>the job is failing or producing output. Specifically, perhaps she's<br>getting Python tracebacks and not telling you... :)
<br><br><br><br>--<br>pkm ~ <a href="http://paulmcnett.com">http://paulmcnett.com</a><br></blockquote></div><br>