首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

Python 程序在eclipse能执行,但cmd里就报import的错了,该如何解决

2013-01-27 
Python 程序在eclipse能执行,但cmd里就报import的错了报错如下:Traceback (most recent call last): File

Python 程序在eclipse能执行,但cmd里就报import的错了
报错如下:
Traceback (most recent call last): 
File "flawfinder.py", line 2415, in flawfind() File "flawfinder.py", line 2408, in flawfind xml.flawcoverWriteAttrib(xml.flawcoverRead()) 
File "C:\Documents and Settings\Administrator\workspace\flawfinder_original\src\flawcover.py", line 23, in flawcoverRead root = etree.fromstring(xmlstr) 
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1301, in XML parser.feed(text) 
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1643, in feed self._raiseerror(v) 
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1507, in _raiseerror raise err xml.etree.ElementTree.ParseError: mismatched tag: line 71, column 2 
我有两个文件 A.PY B.PY
在B.PY中调用
import xml.etree.ElementTree as etree
from xml.dom.minidom import Document
测试在eclipse下和cmd下都好使
而A.PY文件中运行的时候就在eclipse下好使,而在CMD下不好使
A.PY中调用了B.PY里面的类


试过的方法:


import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)

加入当前目录
以上方法都不好使
求指教
[解决办法]
SORRY……你的报错信息和你描述的不一样……

你的报错信息是你的xml文件少了tag……你检查下你xml文件吧……是不是少了结束或者开始标签
[解决办法]
mismatched tag   没有匹配标签

热点排行