[Tutor] crontab or python mistake

Alan Gauld alan.gauld at freenet.co.uk
Fri May 26 09:32:42 CEST 2006


<snip>
> IOError: [Errno 2] No such file or directory: ' emmssg.txt'
</snip>
>
> the emmssg.txt file is in the /root/script directory so i 
> don't know why it cant find it.

The file may be there but crontab isn't. It runs the program 
as root and root's home directory is /.

For this kind of thing you need to either pass in the 
data directory as an argument or wrap the python script 
in a shell script that sets an environment variable to 
where your data is and then runs the pyhon script. 
Within the script use getenv to find the path.

Or just hard code the path...

Alan G



More information about the Tutor mailing list