Open pei-lin-ml opened 3 months ago
Used it in another context than AWS lambda (Beeware framework), but got this fixed by adding the argument by changing cdn_resources
from its standard value ('local')
net = Network(notebook=False, cdn_resources="in_line")
Then it switches to @pei-lin-ml's desired behaviour: https://github.com/WestHealth/pyvis/blob/ccb7ce745ee4159ce45eac70b9848ab965fc0906/pyvis/network.py#L528
https://github.com/WestHealth/pyvis/blame/ccb7ce745ee4159ce45eac70b9848ab965fc0906/pyvis/network.py#L519
This hard coding prevents execution in AWS lambda function. Stack trace:
[ERROR] OSError: [Errno 30] Read-only file system: 'lib' Traceback (most recent call last): File "/var/task/lambda_function.py", line 101, in handler plot_graph_for_originator(df, originator) File "/var/task/lambda_function.py", line 53, in plot_graph_for_originator nt.save_graph(f"/tmp/{html_file}") File "/var/lang/lib/python3.11/site-packages/pyvis/network.py", line 438, in save_graph self.write_html(name) File "/var/lang/lib/python3.11/site-packages/pyvis/network.py", line 519, in write_html os.makedirs("lib") File "<frozen os>", line 225, in makedirs
Instead of hard coded
lib
, it should take the output dir from the designated output file, in the lambda function case it is /tmp.