I have a python script that parses some html and then writes it to output file. I want that cronjob would execute that python script. When I run this script from command line it works fine (python script.py).
Log file:
OSError: [Errno 13] Permission denied: '~/www/test_version/output.txt'
Cronjob:
*/1 * * * * /usr/bin/python /data/script.py 1>/data/log.log 2>&1
Part of the script:
output = "output.txt"
path = os.path.expanduser("~/www/test_version/")
absolute_path = os.path.join(path, output)
if os.path.isfile(absolute_path):
os.remove(absolute_path)
os.path.expanduser("~")
output = open(absolute_path, "w")
~/www/phedex_version
belong to. What are the permissions on~/www/phedex_version
? – EightBitTony Jan 18 at 9:51absolite_path
out of curiosity? Having a hard time believing the error vs the code you're using since it still uses a relative path in its name during error prompt. – Torxed Jan 18 at 10:09~/www/test_version/output.txt
directory, any permissions on theoutput.txt
file if it already exists. You might want to check the permissions on/afs
,/afs/user
,/afs/user/c
,/afs/user/c/cmssst
,/afs/user/c/cmssst/www
as well, just in case. Do the script run when executed from the command line rather than cron? – EightBitTony Jan 18 at 10:20