【发布时间】: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),但这并没有解决问题。