pylint not recognizing some of the standard library

后端 未结 3 1572
逝去的感伤
逝去的感伤 2021-02-13 01:35

I\'m using pylint + pydev, with python 2.6. I have a module with just this line of code

from email import Message

Now when I try to run this mo

3条回答
  •  心在旅途
    2021-02-13 02:29

    The email module uses some horrible import hackery, which has bitten me in the past. You can do this:

    >>> from email import Message
    

    but you can't do this:

    >>> import email
    >>> email.Message
    Traceback (most recent call last):
      File "", line 1, in ?
    AttributeError: 'module' object has no attribute 'Message'
    

    I realise that's not very helpful for making pylint work, but it might help to explain the problem.

提交回复
热议问题