【问题标题】:Google colab download - ConnectionResetError: [Errno 104] Connection reset by peerGoogle colab 下载 - ConnectionResetError: [Errno 104] Connection reset by peer
【发布时间】:2020-05-31 13:50:39
【问题描述】:

我正在使用 google colab,我想自动下载一个文件(可能很大:~100Mo)。目前,我正在使用:

from google.colab import files

files.download('results.zip')

但它并不一致,大多数时候我得到错误:ConnectionResetError: [Errno 104] Connection reset by peer

Exception happened during processing of request from ('::ffff:127.0.0.1', 55642, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.6/socketserver.py", line 320, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 351, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 364, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 724, in __init__
    self.handle()
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/usr/lib/python3.6/http/server.py", line 406, in handle_one_request
    method()
  File "/usr/lib/python3.6/http/server.py", line 639, in do_GET
    self.copyfile(f, self.wfile)
  File "/usr/lib/python3.6/http/server.py", line 800, in copyfile
    shutil.copyfileobj(source, outputfile)
  File "/usr/lib/python3.6/shutil.py", line 82, in copyfileobj
    fdst.write(buf)
  File "/usr/lib/python3.6/socketserver.py", line 803, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

我该如何解决这个问题?或者有什么办法可以自动从 colab 下载文件?

谢谢!

【问题讨论】:

    标签: python file download connection google-colaboratory


    【解决方案1】:

    为了提高可靠性,我建议使用左侧窗格中的文件浏览器而不是 files.download,尤其是当您的文件很大时。

    另一种选择是挂载您的 Google 云端硬盘,然后将 results.zip 文件复制到那里。 Google Drive 同步也可能比直接下载更快。

    【讨论】:

    • 你好,谢谢 :) 我已经知道这个解决方法,但正如我所说,我真的需要将它自动下载到计算机:/
    猜你喜欢
    • 1970-01-01
    • 2019-02-02
    • 2020-01-15
    • 2019-04-30
    • 2016-04-18
    • 2016-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多