0

I am running python 2.7 and am picking up a project from a different developer so I just trying to get it to compile and was getting import errors because the old developer was using "import elementtree.ElementTree as ET" so I am going around and replacing that code with "import xml.etree.ElementTree as ET"

But now ran into this file that still wont compile. Here is the Traceback:

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

Can anyone point me in the right direction?

Here is the first 40 lines of the file.

"""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)
4

1 回答 1

0

问题是你已经修复了StudentEarningReportPanel.py,但是你正在导入StudentEarningReport.py,你还没有修复。

于 2013-01-28T11:10:19.163 回答