【问题标题】:Can't read txt file because of IOpub data rate exceeded由于 IOpub 数据速率超出,无法读取 txt 文件
【发布时间】:2023-03-08 12:07:01
【问题描述】:

我编写了一个小代码来打开、读取、关闭和打印一个 txt 文件。我使用Jupyter notebook 运行它,但文件没有打印出来,而且我收到一条消息说 IOpub 数据速率已超出。

我生成了一个默认配置文件并将值从1000000 增加到10000000,但执行打印输出没有变化。 在代码和消息下方,您知道是什么原因以及我可以做些什么来克服这个问题吗?

已超出 IOPub 数据速率。笔记本服务器将暂时停止 向客户端发送输出以避免崩溃。改变 这个限制,设置配置变量 --NotebookApp.iopub_data_rate_limit。

当前值:

NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

我已生成默认配置文件,并将值从1000000 增加到10000000,但执行打印输出没有变化。

import os
# open Output_log.txt for reading text
myfile = open("E:\\science\\Projet situation\\Output_log.txt", "rt") 
# read the entire file into a string
contents = myfile.read()
# close the file
myfile.close()
# print contents
print(contents)

【问题讨论】:

  • 是的,我按照建议修改了默认配置文件中的值,如下:#c.NotebookApp.iopub_data_rate_limit = 10000000(加一个0),但这并没有解决问题。

标签: python jupyter-notebook


【解决方案1】:

我已经在 anaconda 中尝试了这个 jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10 来启动笔记本,它现在工作正常,正在读取文件。 但是好像每次需要打开notebook都需要执行这个命令,正常吗?

【讨论】:

    猜你喜欢
    • 2018-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-21
    • 2018-11-14
    • 1970-01-01
    • 2023-04-10
    • 2017-09-03
    相关资源
    最近更新 更多