0
log_dir = os.path.abspath(os.path.join(__file__ , "../../", 'logs'))
log_file_path = os.path.join(log_dir, 'Params.txt' % datetime.strftime(datetime.today(), '%Y%m%d'))

I get the following error when I write the above code I don't understand why all of my arguments are strings I am sure. I sense that the problem is in the way I put my space holder but I can't figure it out.

TypeError: not all arguments converted during string formatting
1
  • 1
    What exactly do you expect 'Params.txt' % datetime.strftime(datetime.today(), '%Y%m%d') to return? Commented Jan 19, 2018 at 15:44

1 Answer 1

1

Is this what you are looking for?

log_file_path = os.path.join(log_dir, '%s.txt' % (datetime.strftime(datetime.today(), '%Y%m%d'),))

I'm not exactly sure what you are trying to do with 'Params.txt' and the date? You seem to want to store the date in the file name? If so, I've set it to take the value returned from datetime, stored it in a tuple, and passed it into the filename.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.