Unresolved references when using lxml

(This is related to http://devnet.jetbrains.com/message/5281946#5281946 - "Unresolved reference for Twisted's reactor.run() method" - only more general.)

When I use the lxml library, PyCharm (1.1, 1.1.1, 1.2) generates Unresolved reference warnings for symbols from that library (e.g. etree.Element). The code works fine.

lxml uses weird dynamic loading stuff that probably confuses PyCharm (it confuses ME). E.g.:

def __bootstrap__():
   global __bootstrap__, __loader__, __file__
   import sys, pkg_resources, imp
   __file__ = pkg_resources.resource_filename(__name__,'etree.pyd')
   __loader__ = None; del __bootstrap__, __loader__
   imp.load_dynamic(__name__,__file__)
__bootstrap__()

Is there a way around this? Could a workaround for this be added to PyCharm in the future?

Thanks.

1 comment
Comment actions Permalink

Hello Jurie,

It's possible to make PyCharm aware of the magic that lxml is doing. Please

file an issue at http://youtrack.jetbrains.net/

(This is related to

http://devnet.jetbrains.com/message/5281946#5281946 - "Unresolved

reference for Twisted's reactor.run() method" - only more general.)

When I use the lxml library, PyCharm (1.1, 1.1.1, 1.2) generates

Unresolved reference warnings for symbols from that library (e.g.

etree.Element). The code works fine.

lxml uses weird dynamic loading stuff that probably confuses PyCharm

(it confuses ME). E.g.:

def __bootstrap__():

global __bootstrap__, __loader__, __file__

import sys, pkg_resources, imp

__file__ = pkg_resources.resource_filename(__name__,'etree.pyd')

__loader__ = None; del __bootstrap__, __loader__

imp.load_dynamic(__name__,__file__)

__bootstrap__()

Is there a way around this? Could a workaround for this be added to

PyCharm in the future?

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

Please sign in to leave a comment.