Python 什么是';断言自我。"自我"阅读"未来无&"x27;?(异步)
我目前正在尝试运行一个bokeh服务器应用程序来进行实时绘图,但是我不断从asyncio收到一个断言错误,该错误声明:Python 什么是';断言自我。"自我"阅读"未来无&"x27;?(异步),python,python-asyncio,Python,Python Asyncio,我目前正在尝试运行一个bokeh服务器应用程序来进行实时绘图,但是我不断从asyncio收到一个断言错误,该错误声明: assert self._self_reading_future is None 这不仅发生在我使用自己的程序时,也发生在我使用其他人制作的示例程序时,比如上面的那个。我在github上的asyncio代码中找到了使用self\u reading\u future的唯一地方,但即使在阅读了代码之后,我似乎也无法理解它的含义或作用。有人能告诉我我做错了什么吗 编辑:我正在添加运
assert self._self_reading_future is None
这不仅发生在我使用自己的程序时,也发生在我使用其他人制作的示例程序时,比如上面的那个。我在github上的asyncio代码中找到了使用self\u reading\u future
的唯一地方,但即使在阅读了代码之后,我似乎也无法理解它的含义或作用。有人能告诉我我做错了什么吗
编辑:我正在添加运行代码时在控制台中打印出来的内容。同样,无论我运行什么程序,都会发生错误,但为了显示一些代码,下面是一个示例:
from bokeh.layouts import column
from bokeh.models import ColumnDataSource, Slider
from bokeh.plotting import figure
from bokeh.server.server import Server
from bokeh.themes import Theme
from bokeh.sampledata.sea_surface_temperature import sea_surface_temperature
def modify_doc(doc):
df = sea_surface_temperature.copy()
source = ColumnDataSource(data=df)
plot = figure(x_axis_type='datetime', y_range=(0, 25), y_axis_label='Temperature (Celsius)',
title="Sea Surface Temperature at 43.18, -70.43")
plot.line('time', 'temperature', source=source)
def callback(attr, old, new):
if new == 0:
data = df
else:
data = df.rolling('{0}D'.format(new)).mean()
source.data = ColumnDataSource(data=data).data
slider = Slider(start=0, end=30, value=0, step=1, title="Smoothing by N Days")
slider.on_change('value', callback)
doc.add_root(column(slider, plot))
doc.theme = Theme(filename="theme.yaml")
# Setting num_procs here means we can't touch the IOLoop before now, we must
# let Server handle that. If you need to explicitly handle IOLoops then you
# will need to use the lower level BaseServer class.
server = Server({'/': modify_doc}, num_procs=1)
server.start()
if __name__ == '__main__':
print('Opening Bokeh application on http://localhost:5006/')
server.io_loop.add_callback(server.show, "/")
server.io_loop.start()
这是控制台中打印出来的内容:
server.io_loop.start()
self.asyncio_loop.run_forever()
File "Location", line 314, in run_forever
assert self._self_reading_future is None
AssertionError
如果错误只发生在使用
bokeh
库时,您可能希望在他们的bug追踪器中将其报告为bug。