[Tutor] need help with lxml errors

Steven D'Aprano steve at pearwood.info
Sun May 22 14:22:49 CEST 2011


On Sun, 22 May 2011 09:51:44 pm Rayon wrote:
> I am trying to import lxml
>
> from lxml import etree

And that succeeds fine. Your problem lies elsewhere.

> bb = etree.Element(self.get_time)
>      return str(bb)

In future, please copy and paste (do NOT retype, simplify or summarize) 
the full traceback you get, not just the error message.

In this case, I *think* I can *guess* your error, based on the error 
message alone, but I could be completely off-base. But my guess is that 
you need:

bb = etree.Element(self.get_time())

rather than:

bb = etree.Element(self.get_time)

The later tries to insert a method get_time into the element tree. You 
need to call the method by putting brackets () after it.



-- 
Steven D'Aprano


More information about the Tutor mailing list