pyvis icon indicating copy to clipboard operation
pyvis copied to clipboard

Bug in the Network.write_html?

Open Scoodood opened this issue 2 years ago • 0 comments

https://github.com/WestHealth/pyvis/blob/8ce37e5027d9821c417e941804be924d27eeeef5/pyvis/network.py#L538

I executed the following code within the Jupyterlab cell (under Windows 11), and I expect it to render the plot on an external browser. However, my browser could not find the HTML file.

from pyvis import network as net

g = net.Network()
g.add_node(1)
g.add_node(2)
g.add_node(3)
g.add_edge(1,2)
g.add_edge(2,3)
g.show('example.html')

I realized the prefix ./ messes up the webbrowser.open. So maybe webbrowser is the root cause here? Anyway, after changing

webbrowser.open(f"{tempdir}/{name}")

to

webbrowser.open(name)

I get the expected behavior. Please review and confirm the bug.

Cheers!

Scoodood avatar Jan 09 '23 04:01 Scoodood