【发布时间】:2014-03-11 10:47:54
【问题描述】:
多年来,我的代码中有以下导入:
from etree.ElementTree import fromstring, parse, VERSION
今天我在移动(在 Eclipse/pyDev 中)一些不相关的源文件到另一个文件夹时犯了一个错误。该文件夹不是一个包,我花了一些清理、重建和 del *.pyc-s 才能再次找到它们。该部分已解决,但现在,上面的导入与“未解决的导入...”中断。当我删除 etree 前缀时,导入已解决,但在运行时我得到了
from ElementTree import fromstring, parse, VERSION
File "C:\Program Files\Python\EPD-7.3-2x64\Lib\xml\etree\ElementTree.py", line 127, in <module>
from . import ElementPath
ValueError: Attempted relative import in non-package
出了什么问题..?
【问题讨论】:
标签: import pydev elementtree python-import xml.etree