alexkrycek3
New Member
- Messages
- 6
- Reaction score
- 0
- Points
- 0
Hello,
I have a Python script that writes a timestamp to a log file using the following function:
Cron executes my script (I receive an email with the expected output and no errors), but the log file is not updated. But when I run my script directly the log file *is* updated. I was wondering if someone could help me figure this out. Thanks.
Solved: I went to another forum and they suggested that I include the path to the log file, not just the name. To my surprise, this solved my issue. I'm still not sure why you need a path when both files are in the same directory, but oh well.
I have a Python script that writes a timestamp to a log file using the following function:
Code:
def logfile():
fileIn = open("logfile.txt", "a")
fileIn.write("\n%s" % time.ctime())
fileIn.close()
Cron executes my script (I receive an email with the expected output and no errors), but the log file is not updated. But when I run my script directly the log file *is* updated. I was wondering if someone could help me figure this out. Thanks.
Solved: I went to another forum and they suggested that I include the path to the log file, not just the name. To my surprise, this solved my issue. I'm still not sure why you need a path when both files are in the same directory, but oh well.
Last edited: