Reputation: 23
I am trying to use the current date & time as a file name for my spreadsheet file but I keep on getting the error "no such file or directory exists." Below is the code that I tried to use:
wb = Workbook()
dest_filename = time.strftime("%d/%m/%Y_%H:%M.xlsx")
wb.save(filename = dest_filename)
Upvotes: 1
Views: 82
Reputation: 50560
Look at your file name:
time.strftime("%d/%m/%Y_%H:%M.xlsx")
When this statement is executed it returns a result like this:
'10/06/2015_11:44.xlsx'
Do you have a directory structure that looks like this:
/PathToScript
/10
/06
2015_11:44.xlsx
Those /
s in the file name are indicating directories. If you wish to have a D-M-Y pattern, I suggest using something other than a /
as a separator:
time.strftime("%d-%m-%Y_%H:%M.xlsx")
Upvotes: 2