多年来,我的代码中已经导入了以下内容:
from etree.ElementTree import fromstring, parse, VERSION
今天我在移动(在 Eclipse/pyDev 中)一些不相关的源文件到另一个文件夹时犯了一个错误。该文件夹不是一个包,它花费了我一些清理、重建和 del *.pyc-s 才能再次找到它们。该部分已解决,但现在,上面的导入与“未解决的导入...”中断。当我删除 etree-prefix 时,导入已解决,但在运行时我得到
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
怎么了..?