Menu

code completion failing for lxml library

2007-05-16
2013-03-15
  • Eric Tiffany

    Eric Tiffany - 2007-05-16

    Hi,

    I am running pydev w/extensions 1.33 on Eclipse 3.3beta and python 2.4.3.

    Completion works well for pure python libraries, and also for things like readline.

    But the lxml (http://codespeak.net/lxml/) will only give me a completion for the __bootstrap__() function.  I.e.

    lxml.| <- complete here only gives one function

    The lxml.so is in the PYTHONPATH, and it is listed in the PyDev preferences under "compiled libs" section of the System PYTHONPATH.

    Not sure why this is behaving different, but it would be nice if someone knew how to get completion to work for this library.

    Thanks

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2007-05-17

      Try putting 'lxml' in the 'forced builtins' (see http://www.fabioz.com/pydev/manual_101_interpreter.html for details).

      Cheers,

      Fabio

       
    • Eric Tiffany

      Eric Tiffany - 2007-05-17

      I tried putting lxml into the "forced builtins" section, and also tried adding 'etree' since the .so file inside the lxml module is etree.so.  Note that PyDev already picks up the etree.so from the path and lists it in the "compiled libs" listing (even before I tried adding it to the "forced builtins").

      But none of these things seem to work.

      If I do 'from lxml import etree' in a python shell, I can then do help(etree) and see copious documentation on the library.  However, (slight correction from my original post) if I have this in my file in Eclipse

      from lxml import etree

      etr| <- try completion here gives me the etree package as a completion option.

      etree.| <- try completion here, only get __bootstrap__()

      BTW, I'm running on a MacBook Pro (10.4.9) with python installed via MacOSPorts (in /opt/local/...) and I also have a whole Zope/Plone Products directory in my Eclipse workspace. 

      Still perplexed....

      ET

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2007-05-17

        If you do (in a shell):

        from lxml import etree
        for d in dir(etree): print d

        what do you get?

         
        • Eric Tiffany

          Eric Tiffany - 2007-05-17

          I get a huge list of stuff:

          AncestorsIterator
          AttributeBasedElementClassLookup
          C14NError
          Comment
          CommentBase
          CustomElementClassLookup
          DEBUG
          DTD
          DTDError
          DTDParseError
          DTDValidateError
          DocInfo
          DocumentInvalid
          ETXPath
          Element
          ElementBase
          ElementChildIterator
          ElementClassLookup
          ElementDefaultClassLookup
          ElementDepthFirstIterator
          ElementNamespaceClassLookup
          ElementTree
          Error
          ErrorDomains
          ErrorLevels
          ErrorTypes
          Extension
          FallbackElementClassLookup
          FunctionNamespace
          HTML
          HTMLParser
          LIBXML_COMPILED_VERSION
          LIBXML_VERSION
          LIBXSLT_COMPILED_VERSION
          LIBXSLT_VERSION
          LXML_VERSION
          LxmlError
          LxmlRegistryError
          LxmlSyntaxError
          Namespace
          NamespaceRegistryError
          PIBase
          ParserBasedElementClassLookup
          ParserError
          ProcessingInstruction
          PyErrorLog
          QName
          RelaxNG
          RelaxNGError
          RelaxNGParseError
          RelaxNGValidateError
          Resolver
          SiblingsIterator
          SubElement
          XIncludeError
          XML
          XMLDTDID
          XMLID
          XMLParser
          XMLSchema
          XMLSchemaError
          XMLSchemaParseError
          XMLSchemaValidateError
          XMLSyntaxError
          XPath
          XPathContextError
          XPathDocumentEvaluator
          XPathElementEvaluator
          XPathError
          XPathEvaluator
          XPathFunctionError
          XPathResultError
          XPathSyntaxError
          XSLT
          XSLTAccessControl
          XSLTApplyError
          XSLTError
          XSLTExtensionError
          XSLTParseError
          XSLTSaveError
          _Attrib
          _AttribIterator
          _BaseContext
          _BaseErrorLog
          _BaseParser
          _ClassNamespaceRegistry
          _Comment
          _Document
          _DomainErrorLog
          _Element
          _ElementIterator
          _ElementTagMatcher
          _ElementTree
          _ErrorLog
          _ExceptionContext
          _ExsltRegExp
          _FileParserContext
          _FilelikeWriter
          _FunctionNamespaceRegistry
          _IDDict
          _InputDocument
          _IterparseResolverContext
          _ListErrorLog
          _LogEntry
          _NamespaceRegistry
          _ParserContext
          _ProcessingInstruction
          _ResolverContext
          _ResolverRegistry
          _RotatingErrorLog
          _TempStore
          _Validator
          _XPathContext
          _XPathEvaluatorBase
          _XPathFunctionNamespaceRegistry
          _XSLTContext
          _XSLTProcessingInstruction
          _XSLTResolverContext
          _XSLTResultTree
          __ContentOnlyElement
          __builtins__
          __doc__
          __file__
          __name__
          __version__
          _import_c_api
          clearErrorLog
          dump
          fromstring
          getDefaultParser
          get_default_parser
          iselement
          iterparse
          iterwalk
          parse
          parseid
          setDefaultParser
          setElementClassLookup
          set_default_parser
          tostring
          tounicode
          useGlobalPythonLog
          >>>

           
          • Fabio Zadrozny

            Fabio Zadrozny - 2007-05-17

            Ok, can you please report that as a bug (and reference this thread from there)... I'll take a look at what can be causing that, but I have to be able to reproduce it, and I won't be able to check this better until next week.

            Cheers,

            Fabio