Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative import 'six.moves.urllib.parse', should be 'six.moves' (relative-import) #2180

Closed
mgedmin opened this issue Jun 12, 2018 · 5 comments
Labels
Bug 🪲 python past end of life This affect a python version we do not support anymore

Comments

@mgedmin
Copy link

mgedmin commented Jun 12, 2018

Steps to reproduce

  1. create a virtualenv
  2. install six and pylint
  3. create a wtf.py with one line of code:
from six.moves.urllib.parse import urljoin
  1. run pylint wtf.py

Current behavior

************* Module wtf
...
W:  1, 0: Relative import 'six.moves.urllib.parse', should be 'six.moves' (relative-import)
...

Expected behavior

No relative-import error

pylint --version output

pylint 1.9.1, 
astroid 1.6.4
Python 2.7.14 (default, Sep 23 2017, 22:06:14) 
[GCC 7.2.0]
@PCManticore PCManticore added Bug 🪲 python past end of life This affect a python version we do not support anymore labels Jul 3, 2018
@PCManticore
Copy link
Contributor

Thanks for the report!

openstack-gerrit pushed a commit to openstack-archive/stx-nfv that referenced this issue Jan 15, 2019
replace unicode by six.text_type
replace urlparse by six.moves.urllib.parse
remove the ignore for F821 from the flake8 config

PS: as there is a bug of pylint 1.9, six.moves.urllib.parse
should be import as follows:
e.g.
 from doc of module six:
   from six.moves.urllib.parse import urlparse
   urlparse(endpoint).path

 here:
   from six.moves import urllib
   urllib.parse.urlparse(endpoint).path

pylint bug: pylint-dev/pylint#2180

Story: 2003427
Task: 24605
Task: 24608

Change-Id: I098ba8093dbf08dd91acaf403291ebb469195558
Signed-off-by: SidneyAn <ran1.an@intel.com>
@rouge8
Copy link

rouge8 commented Apr 25, 2019

I think this is fixed in the current pylint

@mgedmin
Copy link
Author

mgedmin commented Apr 25, 2019

Yup, I cannot reproduce any more with

$ pylint --version
pylint 2.3.1
astroid 2.2.5
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0]

@mgedmin mgedmin closed this as completed Apr 25, 2019
@dominiclondon
Copy link

Still experiencing this issue with pylint 1.9.5.

pylint --version
No config file found, using default configuration
pylint 1.9.5,
astroid 1.6.6
Python 2.7.17 (default, May  3 2020, 21:21:37)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.17)]

@Pierre-Sassoulas
Copy link
Member

We're not supporting python 2.7 anymore, and we will not make pylint 1.9 evolves. You need to use python3 to have the latest features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🪲 python past end of life This affect a python version we do not support anymore
Projects
None yet
Development

No branches or pull requests

5 participants