尝试jsonpickle.encode pptx.Presentation

问题描述

我有一个pptx文件,我想将其加载到Python-PPTX中并对其进行腌制并将其转换为json。

from jsonpickle import encode
from pptx import Presentation

pres = Presentation("example.pptx")
js = encode(pres)

不幸的是,我在酸洗过程中遇到错误

TypeError: descriptor '__dict__' for '_OxmlElementBase' objects doesn't apply to 'CT_CoreProperties' object

这似乎在酸洗步骤中

~\AppData\Local\Continuum\anaconda3\lib\site-packages\jsonpickle\pickler.py in _flatten_obj_instance(self,obj)

我想我要么不能腌制Presentation对象,而是希望Scanny回答,或者其他熟悉Python-PPTX的人可以回答。

编辑:

看来您无法腌制这个CT_coreProperties对象,这非常令人失望。

import pickle
from pptx import Presentation

pres = Presentation("example.pptx")
pickled = pickle.dumps(pres)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)