问题遇到的现象和发生背景
运用**pyLDAvis 3.3.1 **进行分析,已经分析出了主题词,但是结果无法可视化报错,报错内容如下:
问题相关代码,请勿粘贴截图
Traceback (most recent call last):
File "D:\333\main.py", line 38, in <module>
pyLDAvis.save_html(plot, './result/pyLDAvis.html')
File "D:\Python3.9\lib\site-packages\pyLDAvis\_display.py", line 351, in save_html
fileobj = open(fileobj, 'w')
FileNotFoundError: [Errno 2] No such file or directory: './result/pyLDAvis.html'
这里,我又查看了__display.py的第349-357行代码,内容如下:
try:
if isinstance(fileobj,str ):
fileobj = open(fileobj, 'w')
except NameError:
if isinstance(fileobj, str):
fileobj = open(fileobj, 'w')
if not hasattr(fileobj, 'write'):
raise ValueError("fileobj should be a filename or a writable file")
fileobj.write(prepared_data_to_html(data, **kwargs))
运行结果及报错内容
但是经过反复搜索都没有找出问题所在,大概是什么原因导致我的可视化图表无法储存呢?
我的解答思路和尝试过的方法
本人初次尝试相关软件,=代码,还请各位不吝赐教!