我一直在寻找一个小时,并尝试了所有可能的解决办法。缩进并重新缩进并移动该字符串,计算括号。什么都行不通。我只是试图复制发布的代码here作为一个解决方案(所以它必须在某个时候为某人工作)。
我一直得到SyntaxError: EOF while scanning triple-quoted string literal
错误。
import numpy as np
from bokeh.io import show
from bokeh.layouts import widgetbox
from bokeh.models.widgets import CheckboxGroup
from bokeh.models import CustomJS, ColumnDataSource
from bokeh.layouts import column, row
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(3*np.pi*t)
c = np.cos(3*np.pi*t)
source = ColumnDataSource(data=dict(t=t, s=s, c=c))
plot = figure(plot_width=400, plot_height=400)
a = plot.line('t', 's', source=source, line_width=3, line_alpha=0.6, line_color='blue')
b = plot.line('t', 'c', source=source, line_width=3, line_alpha=0.6, line_color='red')
checkbox = CheckboxGroup(labels=["Cosinus", "Sinus"], active=[0,1])
checkbox.callback = CustomJS(args=dict(line0=a, line1=b), code="""
//console.log(cb_obj.active);
line0.visible = false;
line1.visible = false;
for (i in cb_obj.active) {
//console.log(cb_obj.active[i]);
if (cb_obj.active[i] == 0) {
line0.visible = true;
} else if (cb_obj.active[i] == 1) {
line1.visible = true;
}
}
""")
layout = row(plot, widgetbox(checkbox))
show(layout)
我是VSCode扩展的开发人员。我们遇到了三重引用字符串的问题。
https://github.com/Microsoft/vscode-python/issues/5012
目前已解决此问题,但仅限于我们的开发版本。要获得修复,您可以等到下周我们每月的延期发布时间。或者,如果你想要你可以拿起我们的开发版本,我们一直在修复。
https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build
如果您安装了开发版本,那么当该版本发布时,它将自动更新为完整的测试版本。
对此引起的烦恼感到抱歉。