我正在运行Python2.7,并从不同的开发人员那里挑选了一个项目,所以我只是试图编译它,但得到了导入错误,因为旧的开发人员正在使用“将elementtree.ElementTree作为ET导入”,所以我使用了“将xml.etree.ElementTree作为ET导入”来替换该代码。
但是现在遇到了这个文件,它仍然不能编译。下面是回溯:
C:\Users\Daniel\Documents\Time clock\source\TimeClock>python timeclock.py
Traceback (most recent call last):
File "timeclock.py", line 30, in <module>
from CheckHoursDialog import CheckHoursDialog
File "C:\Users\Daniel\Documents\Time clock\source\TimeClock\CheckHoursDi
alog.py", line 11, in <module>
from StudentEarningReport import StudentEarningReport
File "C:\Users\Daniel\Documents\Time clock\source\TimeClock\StudentEarni
ngReport.py", line 10, in <module>
import elementtree.ElementTree as ET
ImportError: No module named elementtree.ElementTree有谁能给我指个方向吗?
以下是文件的前40行。
"""StudentEarningReportPanel
Panel to show what students earned, based on the StudentEarningReport.
"""
__history__ = """History:
3/18/2010: Added ShowXML button
"""
import wx
import wx.lib.scrolledpanel as scrolled
from datetime import datetime as DT
import xml.etree.ElementTree as ET
from PyCollapsiblePane import PyCollapsiblePane as PCP
#~ try:
#~ from agw import pycollapsiblepane as PCP
#~ except ImportError: # if it's not there locally, try the wxPython lib.
#~ import wx.lib.agw.pycollapsiblepane as PCP
CP = PCP.PyCollapsiblePane
class ReportPanel(scrolled.ScrolledPanel):
"""ReportPanel(parent, node)
Parent is the wx.Window-based parent.
Node is an ElementTree.Element created by StudentEarningReport.py
"""
def OnPaneChanged(self, evt=None):
self.SetupScrolling(scrollToTop=False)
def __init__(self, parent, node):
assert ET.iselement(node)
#~ ET.dump(node)
self.Elem = node
scrolled.ScrolledPanel.__init__(self, parent, style=wx.BORDER_SIMPLE)发布于 2013-01-28 19:10:19
问题是您已经修复了StudentEarningReportPanel.py,但是您正在导入StudentEarningReport.py,而您还没有修复它。
https://stackoverflow.com/questions/14560545
复制相似问题