[lxml-dev] could not find doctest

Mary Lei lei at ipac.caltech.edu
Tue May 19 23:40:13 CEST 2009


I copied the following from the lxml document on the web:

#! /stage/irsa-sw-dev/cm/env_1.4_mnt/python/bin/python

import urllib
import urllib2
import urlparse
import os
import popen2
import StringIO
import sys, getopt
import re
import string
import doctest
version = sys.version_info

print "python version: ", version

print os.environ['PYTHONPATH']

## test with lxml
import lxml.html
from lxml.html import builder as E
from lxml.html import usedoctest

html = E.HTML(
    E.HEAD(
      E.LINK(rel="stylesheet", href="great.css", type="text/css"),
      E.TITLE("Best Page Ever")
    ),
    E.BODY(
      E.H1(E.CLASS("heading"), "Top News"),
      E.P("World News only on this page", style="font-size: 200%"),
      "Ah, and here's some more text, by the way.",
      lxml.html.fromstring("<p> and this is a parsed fragment </p>")
    )
  )

print lxml.html.tostring(html)

And got the following error:

python version:  (2, 5, 1, 'final', 0)
.:/home/lei/python-stuff/BeautifulSoup-3.1.0.1:./lib:/home/lei/lxml-2.2/src
Traceback (most recent call last):
   File "/home/lei/python-stuff/test_lxml_htmlout.py", line 22, in <module>
     from lxml.html import usedoctest
   File "/home/lei/lxml-2.2/src/lxml/html/usedoctest.py", line 13, in 
<module>
     doctestcompare.temp_install(html=True, del_module=__name__)
   File "/home/lei/lxml-2.2/src/lxml/doctestcompare.py", line 395, in 
temp_install
     frame = _find_doctest_frame()
   File "/home/lei/lxml-2.2/src/lxml/doctestcompare.py", line 486, in 
_find_doctest_frame
     "Could not find doctest (only use this function *inside* a doctest)")
LookupError: Could not find doctest (only use this function *inside* a 
doctest)

Any clues to this problem ?

-- 
Mary Lei

Software Testing
IPAC-NExScl

Rm: KS-233
MS: 220-6
Phone: 395-1998



More information about the lxml-dev mailing list