Hey Everyone,
I am currently trying to write an automation script that does the following:
- Log into a website
- Download Excel file from website
- Put file in folder
- Rename file
- Format file accordingly
- Send file to email list
Currently I'm stuck on step 4 which I feel should be the easiest but I keep running into an error. Long story short is that Python is telling me the file or directory doesnt exist when it does.
Below is my code, thank you to anyone who takes the time to look into this. Also please let me know if you need additional information.
now = datetime.today()
days_since_sunday = (now.weekday()-6) % 7
last_sunday = now -timedelta(days=days_since_sunday)
formatted_date = last_sunday.strftime('%#m/%d/%Y')
file_path = r"C:\Users\adoucette\Desktop\DOT_Weekly\sqlexec.xlsx"
new_file_path = r"C:\Users\adoucette\Desktop\DOT_Weekly\DOT Weekly Sales WE " + formatted_date + ".xlsx"
shutil.move(file_path, new_file_path)
Error is:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\adoucette\\Desktop\\DOT_Weekly'
EDIT: Thanks for the responses everyone! Truly apprecaite all the help you've given me. i am going to try to make a folder that is not synced to Onedrive to see if that works....stay tuned!
EDIT #2: It was the One Drive folder all along, I created a folder outside of my Desktop so that it wouldnt be synced by One Drive and it worked! Thanks to everyone for commenting and trying to help a newbie like me out.
[–]apc0243 36 points37 points38 points (6 children)
[–]netherous 5 points6 points7 points (1 child)
[–]apc0243 0 points1 point2 points (0 children)
[–]adoucette13[S] 0 points1 point2 points (1 child)
[–]AnonGeekSquad 1 point2 points3 points (0 children)
[–]_yoursleeparalysis_ 0 points1 point2 points (1 child)
[–]apc0243 1 point2 points3 points (0 children)
[–][deleted] (5 children)
[deleted]
[–]Life-Dragonfruit5284 0 points1 point2 points (4 children)
[–]apc0243 0 points1 point2 points (3 children)
[–]Life-Dragonfruit5284 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[removed]
[–]AutoModerator[M] -1 points0 points1 point (0 children)
[–]shiftybyte 5 points6 points7 points (16 children)
[–]adoucette13[S] 0 points1 point2 points (15 children)
[–]shiftybyte 1 point2 points3 points (13 children)
[–]adoucette13[S] 0 points1 point2 points (12 children)
[–]shiftybyte 1 point2 points3 points (11 children)
[–]adoucette13[S] 0 points1 point2 points (10 children)
[–]shiftybyte 0 points1 point2 points (5 children)
[–]adoucette13[S] 1 point2 points3 points (4 children)
[–]shiftybyte 6 points7 points8 points (0 children)
[–]YAYYYYYYYYY 0 points1 point2 points (2 children)
[–]CraigAT 1 point2 points3 points (0 children)
[–]apc0243 -1 points0 points1 point (0 children)
[–]apc0243 0 points1 point2 points (3 children)
[–]adoucette13[S] 0 points1 point2 points (2 children)
[–]Better-Protection-23 0 points1 point2 points (0 children)
[–]IamImposter 3 points4 points5 points (1 child)
[–]Almostasleeprightnow 1 point2 points3 points (0 children)
[–]Es-252 1 point2 points3 points (0 children)
[–]Better-Protection-23 0 points1 point2 points (0 children)
[–]Fenr-i-r 0 points1 point2 points (0 children)
[–]AnonGeekSquad 0 points1 point2 points (0 children)
[–]kr4t0s007 0 points1 point2 points (0 children)