模板导入异常
模板导入错误把这个脚本放在windows桌面或C:\下运行:Python code#!/usr/bin/env python#codingutf-8from
模板导入错误
把这个脚本放在windows桌面或C:\下运行:
Python code#!/usr/bin/env python#coding=utf-8from xml.dom.minidom import parsedom = parse(r'F:\cyditu\YFMapWeb\YFMap\YF.YFMap.UI\YF.YFMap.UI.csproj')root = dom.documentElementnodes = root.getElementsByTagName("Compile")for node in nodes: print node.getAttribute('Include')
IDLE 2.6 ==== No Subprocess ====
>>>
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\桌面\xml.py", line 4, in <module>
from xml.dom.minidom import parse
File "C:\Documents and Settings\Administrator\桌面\xml.py", line 4, in <module>
from xml.dom.minidom import parse
ImportError: No module named dom.minidom
把相同脚本放在C:\Python26\ 下运行正常;
C:\Python26已被加入到系统环境变量了;
xml.dom.minidom路径为C:\Python26\Lib\xml\dom\minidom.py,从shell导入没问题。
[解决办法]File "C:\Documents and Settings\Administrator\桌面\xml.py"
你的脚本文件名和模块同名,十之八九会有冲突,改一下脚本名吧...