I am trying to upload a file from my computer to google drive using Python(Pydrive), it gets uploaded succesfully but gets damaged and its size becomes 0kb.
Here is my code:
drive = GoogleDrive(gauth)
import glob, os
with open('C:\\Users\\New\\Pictures\\Screenshots\\older\\Screenshot.png', 'r') as file:
fn = os.path.basename(file.name)
file_drive = drive.CreateFile({"title": fn })
file_drive.Upload()
print('The file: ' + fn + ' has been uploaded')
print('Successful')
What I am doing wrong? I have done the Authentication part and it's Authenticated successfully.
I have checked answers related to this but I didn't get the answer I am looking for.