[code-quality] Pylint -- so which is it?

Jakub Wilk jwilk at jwilk.net
Tue Apr 4 11:04:58 EDT 2017


* Stephen Satchell <list at satchell.net>, 2017-04-03, 11:27:
>I have a python2.7 project, and when I run PyLint 1.5.2, astroid 1.3.3

That's an unlikely combination. This version of Pylint requires astroid >= 1.4.

>When I have:
>    import logging
>    import pexpct
>    import re
>    import time
>
>I get messages about wrong import order, specifically that re and time comes 
>after pexpect.

After fixing the typo, I get:

C:  3, 0: standard import "import re" comes before "import pexpect" (wrong-import-order)
C:  4, 0: standard import "import time" comes before "import pexpect" (wrong-import-order)

...which seems backwards? The problem is that these imports are AFTER "import 
pexpect", but they should be before.

>OK, apply the obvious fix:
>    import logging
>    import re
>    import time
>
>    import pexect

This looks fine to me, except for another typo. And indeed, I don't get any 
warnings about import order this time.

>So how do I fix this,

I'd start with producing a complete, minimal example, so that other people can 
reproduce the bug you're seeing. :)

-- 
Jakub Wilk


More information about the code-quality mailing list