Safari 15 Issue: Saved standalone plots produce NSPOSIXErrorDomain:1

I am trying to write standalone Bokeh utilities with interactive CustomJS elements that can be saved as HTML files for later use. In previous versions of Safari (14.x.x, Early 15.0), examples like the one given below opened just fine and worked as expected. Safari 15.1 (17612.3.5) yields an NSPOSIXErrorDomain:1 error. Current versions of Chrome and Edge (as of writing this post) open the file just fine.

Even running the example below in Jupyter in Safari with output_notebook works as expected (and can also be run in a separate window by omitting output_notebook), but trying to open the generated file produces the error.

I’m sure this is a Safari issue, and not a Bokeh one, but I’m wondering if anyone has any ideas.

import numpy as np
from bokeh.io import output_notebook,save
from bokeh.layouts import column, row
from bokeh.models import CustomJS, Slider
from bokeh.plotting import ColumnDataSource, figure, show

x = np.linspace(0, 10, 500)
y = np.sin(x)

source = ColumnDataSource(data=dict(x=x, y=y))

plot = figure(y_range=(-10, 10), width=400, height=400)

plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)

amp_slider = Slider(start=0.1, end=10, value=1, step=.1, title="Amplitude")
freq_slider = Slider(start=0.1, end=10, value=1, step=.1, title="Frequency")
phase_slider = Slider(start=0, end=6.4, value=0, step=.1, title="Phase")
offset_slider = Slider(start=-5, end=5, value=0, step=.1, title="Offset")

callback = CustomJS(args=dict(source=source, amp=amp_slider, freq=freq_slider, phase=phase_slider, offset=offset_slider),
                    code="""
    const data = source.data;
    const A = amp.value;
    const k = freq.value;
    const phi = phase.value;
    const B = offset.value;
    const x = data['x']
    const y = data['y']
    for (let i = 0; i < x.length; i++) {
        y[i] = B + A*Math.sin(k*x[i]+phi);
    }
    source.change.emit();
""")

amp_slider.js_on_change('value', callback)
freq_slider.js_on_change('value', callback)
phase_slider.js_on_change('value', callback)
offset_slider.js_on_change('value', callback)

layout = row(
    plot,
    column(amp_slider, freq_slider, phase_slider, offset_slider),
)
output_notebook()
show(layout)
save(layout, 'test.html')

Everything online seems to suggest this is related to firewall settings/blocking. Can you reproduce this on safari 15.1 on different Mac on another network?

Attempting to do so now. I am suspicious that this is the cause, though.
-Changing networks (but not computer) does not resolve the issue.
-Can confirm it does run on Version 15.0 (16612.1.29.41.4, 16612) (different comp/network)
-Can confirm it runs on Version 14.1.5 on the same network (different comp)

Will update once I find someone with 15.1.

Well, for reference I have 15.1 installed on this laptop and have no issues view docs, locally saved standalone content, or Bokeh server apps. Perhaps you have a local OSX network configuration that is intersecting with the 15.1 update, just on your laptop?

Thanks for that data point!

After some more exerpimentation I have discovered that it has something to do with local disk access permissions. For example, the file opens as expected when opened from iCloud, dropbox or even /Users/andrew (me) but not from ~/Documents or ~/Desktop.

It seems this has been a problem before, but these solutions don’t appear to work anymore.

At least I can open things when saved elsewhere now. Thank you for your help!

Thanks for the update and especially the link. This definitely seems like an upstream problem that is outside our control, but at least anyone else in the future can have this as a reference.

Granting full disk access resolves the issue. It may not be in the list of apps, but can be added using the plus button. Strangely the ability to restrict files and folders is not available and this was not an issue for me a month or so ago. I suspect a Monterey bug.

1 Like