[英]python unhandled exception
I am working with MODO python scripts. 我正在使用MODO python脚本。 I imported the MODO setting data into .cfg file with the XML format .
我将MODO设置数据导入XML格式的 .cfg文件中。
My .cfg file looks like this: 我的.cfg文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<camera>
<Position>
<X>
2.0
</X>
<Y>
0.75
</Y>
<Z>
4.0
</Z>
</Position>
"
"
so on......
Now,i wanted to export this file into my MODO application.So,i need to parse this . 现在,我想将此文件导出到我的MODO应用程序中。因此,我需要对此进行解析。 cfg file (xml format).
cfg文件(xml格式)。
I tried this: 我尝试了这个:
#python
import lx
import xml.dom.minidom
from xml.dom.minidom import Node
dom1 = xml.dom.minidom.parse("c:\myfile.cfg")
When i try to run this script in my MODO application,it gives me following error: 当我尝试在MODO应用程序中运行此脚本时,出现以下错误:
Line 26 is dom1 = xml.dom.minidom.parse("c:\\myfile.cfg")
第26行是
dom1 = xml.dom.minidom.parse("c:\\myfile.cfg")
How do i parse my .cfg file with xml format using minidom object in python ??? 我如何使用python中的 minidom对象解析XML格式的.cfg文件? Thanx in advance.
提前感谢。
Python mindom文档页面上有一个很好的示例,您也可以考虑使用更易于编写的JSON或将Python对象序列化为 JSON。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.