Python and Cron

Paul McNett p at ulmcnett.com
Fri Sep 7 14:47:10 EDT 2007


Greg Lindstrom wrote:
> This may be more of a Linux question, but I'm hoping some of you may be 
> able to help me.
> 
> I have a python (2.4) routine running on Gentoo Linux.  It creates a 
> file and, after the file is complete, renames the file using the 
> os.rename() command.  When I run the file from the command line 
> everything works great, but when I schedule the job to run from the 
> crontab file, the original file is created and populated, but the rename 
> fails.  I am using full paths for both the original and destination 
> file, and run the command line version after I 'su' to the production 
> account (named 'edith').  I am told by my sysadmin that the cron jobs 
> run as edith as well, so he does not think it is a permission issue (he 
> points out the original file is being created and populated as 
> expected...the rename fails)
> 
> Have any of you dealt with anything like this?  It really has me 
> scratching my head.

Can you post the Python script?

What's the name of the original file, and what are you trying to rename 
it to? I'm wondering if you are deriving the new name from something, 
and that thing is failing from within the cronjob for some reason. 
Perhaps the new name contains a complete path in one of the cases but 
not in the other...

Edith should be getting email (if email routing is set up correctly) if 
the job is failing or producing output. Specifically, perhaps she's 
getting Python tracebacks and not telling you... :)



-- 
pkm ~ http://paulmcnett.com



More information about the Python-list mailing list