-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
AttributeError: module 'psutil_linux' has no attribute '__file__' #934
Comments
This is weird. What psutil version are you using? The |
@giampaolo no, I added those lines here to debug the problem. So these lines were added: print(__version__)
print(int(__version__.replace('.', '')))
print(getattr(_psplatform.cext, 'version', None))
print(_psplatform.cext.__file__) with only 3 results printed:
And that last print produces ( msg = "version conflict: %r C extension module was built for another " \
"version of psutil (different than %s)" % (_psplatform.cext.__file__,
__version__) This is using 4.4.2 (+these prints). Hope that makes sense.. |
OK, I fixed this in 58c4b3d and I also provided a better error message printing both versions: _ImportError: version conflict: '/home/giampaolo/svn/psutil/psutil/_psutil_linux.so' C extension module was built for another version of psutil (4.4.1 instead of 4.4.2); you may try to 'pip uninstall psutil', manually remove /home/giampaolo/svn/psutil/psutil/psutil_linux.so or clean the virtual env somehow, then reinstall |
Awesome, thanks @giampaolo! |
#564 adds detection for version mismatches, like the code below.
I've modified this code to print out some debug info:
And that creates the following traceback:
As you can see it detected a 4.4.1 python version and a 4.4.2 C-extension version (which is a mistake I corrected, I used old psutil files with a newer compiled 4.4.2 version of the c-extensions). It then tries to raise an ImportError that, in my case, raises an AttributeError itself because it cannot find
_psplatform.cext.__file__
.My app compiles psutil using pyqtdeploy 1.3.1 and Python 3.5.2 that turns it into a native Qt application. This causes the
__file__
attribute to be missing I suspect. Can we add a check for this attribute and ignore it when it doesn't exist?The text was updated successfully, but these errors were encountered: