0
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/googleapiclient/http.py", line 578, in _del_
    self._fd.close()
AttributeError: 'MediaFileUpload' object has no attribute '_fd'

I got the same error while executing MediaFileUpload() but It's fine to work in the windows machine. Anyone here can please help me. Thanks

my code is:

    try:
        file_metadata = {'name': filename, 'parents': [folder_id]}
        media = MediaFileUpload(filepath,
                                mimetype=mimetype,resumable=True)
        file = drive_service.files().create(body=file_metadata,
                                            media_body=media).execute()
        print('Uploaded File ID: %s' % file.get('id'))
    except Exception as e:
        print(e)
AKX
  • 152,115
  • 15
  • 115
  • 172
  • Welcome to Stack Overflow, thanks for phrasing your question clearly. You're off to a great start! – edge-case Mar 23 '20 at 18:46
  • Please provide a [mcve]. Be careful about using `except Exception` like that, see https://stackoverflow.com/questions/54948548/what-is-wrong-with-using-a-bare-except. – AMC Mar 23 '20 at 21:41

0 Answers0