Answer the question
In order to leave comments, you need to log in
How to write a file in python when run via cron?
A python3 program that has these lines:
python3
with open('log.txt', 'a') as f:
f.write(date.strftime('%d-%m-%Y %X') + ' some text')
f.close()
Answer the question
In order to leave comments, you need to log in
study under which user the cron runs the command and in which directory (it is not yours by default ~)
for the future, learn to write full paths for all files and your hair will be soft and silky :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question