Note that I run on Windows, you don't (/usr/bin/python2). Also note that programs using psutil run fine.
Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\owillebo>python Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import psutil >>> C:\Users\owillebo>echo import psutil > test.py C:\Users\owillebo>pylint test.py No config file found, using default configuration ************* Module test C: 1, 0: Trailing whitespace (trailing-whitespace) C: 1, 0: Missing module docstring (missing-docstring) F: 1, 0: Unable to import 'psutil' (import-error) W: 1, 0: Unused import psutil (unused-import) .... On Wed, Sep 23, 2015 at 12:29 PM, Florian Bruhin <m...@the-compiler.org> wrote: > * Okko Willeboordse <okko.willeboor...@gmail.com> [2015-09-22 21:30:28 +0200]: >> import psutil >> >> Gives; [F0401] Unable to import 'psutil' > > Works fine here: > > $ virtualenv .venv2 > Running virtualenv with interpreter /usr/bin/python2 > New python executable in .venv2/bin/python2 > Also creating executable in .venv2/bin/python > Installing setuptools, pip...done. > > $ source .venv2/bin/activate > > $ pip install psutil pylint > Downloading/unpacking pylint > Downloading pylint-1.4.4-py2.py3-none-any.whl (428kB): 428kB downloaded > Downloading/unpacking psutil > Downloading psutil-3.2.1.tar.gz (251kB): 251kB downloaded > [...] > Downloading/unpacking six (from pylint) > Downloading six-1.9.0-py2.py3-none-any.whl > Downloading/unpacking astroid>=1.3.6 (from pylint) > Downloading astroid-1.3.8-py2.py3-none-any.whl (183kB): 183kB downloaded > Downloading/unpacking logilab-common>=0.53.0 (from pylint) > Downloading logilab-common-1.0.2.tar.gz (190kB): 190kB downloaded > [...] > > $ echo 'import psutil' > foo.py > > $ pylint foo.py -rn > No config file found, using default configuration > ************* Module foo > C: 1, 0: Black listed name "foo" (blacklisted-name) > C: 1, 0: Missing module docstring (missing-docstring) > W: 1, 0: Unused import psutil (unused-import) > > It sounds like the python your pylint is installed for doesn't have > the psutil package (e.g. because you run your code in a virtualenv > typically, but use a system-wide pylint package). > > Florian > > -- > http://www.the-compiler.org | m...@the-compiler.org (Mail/XMPP) > GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc > I love long mails! | http://email.is-not-s.ms/ _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality