Skip to content

Unable to import 'distutils.util' #2955

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

Closed
crazyscientist opened this issue Jun 12, 2019 · 7 comments
Closed

Unable to import 'distutils.util' #2955

crazyscientist opened this issue Jun 12, 2019 · 7 comments

Comments

@crazyscientist
Copy link

There are quite a few related issues (e.g. #1691), but none mention this particular issue. Somehow distutils.util cannot be processed by pylint.

Steps to reproduce

  1. Import something from distutils.util
  2. Run pylint

Current behavior

Pylint produces two errors for the import statement:

# In the file
from distutils.util import strtobool
# In the output
************* Module [...].run_agents
[...]run_agents.py:33:0: E0611: No name 'util' in module 'distutils' (no-name-in-module)
[...]run_agents.py:33:0: E0401: Unable to import 'distutils.util' (import-error)

Expected behavior

None of the above error messages

pylint --version output

pylint 2.3.1
astroid 2.2.5
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0]
@crazyscientist
Copy link
Author

Looks like this might be a duplicate of #73...

@Pierre-Sassoulas
Copy link
Member

If it is, it has been fixed 21 days ago in pylint-dev/astroid#672 and might be available in the next release.

@crazyscientist
Copy link
Author

OK, just checked out the master branch and ran pylint on the problematic file.

Looks like the reason for the errors is the same as for #73, but it was not fixed by said pull request :(

@chingc
Copy link

chingc commented Jun 18, 2019

I'm having the same issue with import distutils.dir_util

@PCManticore
Copy link
Contributor

Thanks for confirming it's not working for you, we'll check why is that.

@AWhetter
Copy link
Contributor

AWhetter commented Jul 3, 2019

I can't reproduce this.
I'm using virtualenv 16.1.0 with

pylint 2.4.0-dev0
astroid 2.3.0
Python 3.6.8 (default, May 21 2019, 02:17:32) 
[GCC 8.3.0]

I have no custom config set on pylint and I'm running it on a file containing

from distutils.util import strtobool

If you look at the fix in pylint-dev/astroid#672, is the condition that was added getting triggered? Are you able to find why not?

@crazyscientist
Copy link
Author

If you look at the fix in pylint-dev/astroid#672, is the condition that was added getting triggered? Are you able to find why not?

Found it, actually using this unpublished version of astroid containing the fix helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants