Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
discovery.build调用导致python停止工作_Python_Google Drive Api - Fatal编程技术网

discovery.build调用导致python停止工作

discovery.build调用导致python停止工作,python,google-drive-api,Python,Google Drive Api,我一直在编写一个脚本,将.csv文件上传到谷歌硬盘。该脚本一整天都在工作,但最近它一直在崩溃/导致python停止工作。当我打电话时,它似乎崩溃了: service = discovery.build('drive', 'v3', http=http) 以下是脚本的主要功能: def main(): credentials = get_credentials() http = credentials.authorize(httplib2.Http()) service

我一直在编写一个脚本,将.csv文件上传到谷歌硬盘。该脚本一整天都在工作,但最近它一直在崩溃/导致python停止工作。当我打电话时,它似乎崩溃了:

service = discovery.build('drive', 'v3', http=http)
以下是脚本的主要功能:

def main():
    credentials = get_credentials()
    http = credentials.authorize(httplib2.Http())
    service = discovery.build('drive', 'v3', http=http)
    #upload to Reload Folder
    folder_id = 'RealIdExcluded'
    file_metadata = {
        'name': 'allStats.csv',
        'mimeType' : 'application/vnd.google-apps.spreadsheet' 
    }

    media = MediaFileUpload('statOutput.csv',
                            mimetype = 'text/csv',
                            resumable = True)
    file = service.files().update(body= file_metadata,
                                    media_body=media,
                                    fields = 'id',
                                    fileId = 'RealIdExcluded').execute()
    print('File ID: %s' % file.get('id'))

任何帮助都是了不起的。谢谢

我从来没有发现问题所在,但我卸载了python并重新安装了它,它似乎解决了问题。

我从来没有发现问题所在,但我卸载了python并重新安装了它,它似乎解决了问题。