-
-
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
[Windows 10] When using Python 3.12 psutil.disk_usage is raising an error not seen on other Python versions #2252
Comments
Hi Mike!
What error? I don't see any. Perhaps you forgot to paste it? |
Don't you have a full python traceback message? I'm not sure where that line is coming from, but it's not psutil. |
Lemme remove the |
Let's see if this is better. I hardcoded a call to: usage = psutil.disk_usage('A:\\')
|
Here's a 2 line replication I managed to get using REPL: C:\Python\PycharmProjects\PSG>py312
Python 3.12.0a7 (tags/v3.12.0a7:b861ba4, Apr 4 2023, 16:33:41) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_usage('A:\\')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "X:\Python\Python3.12\Lib\site-packages\psutil\__init__.py", line 2005, in disk_usage
return _psplatform.disk_usage(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "X:\Python\Python3.12\Lib\site-packages\psutil\_pswindows.py", line 280, in disk_usage
total, free = cext.disk_usage(path)
^^^^^^^^^^^^^^^^^^^^^
SystemError: argument 1 (impossible<bad format char>)
>>> |
Well, that's weird. Looks like a Python 3.12 bug. |
Thank you for the super-fast work on this one! That's the conclusion I came to as well since your stuff is rock solid on all the testing I've been doing, on all versions of Python 3.6-3.11. Only 3.12 has this. |
This is related to the warning seen in #2255
|
Summary
Description
This is only happening on Python 3.12A. No other versions of Python are showing this problem (I've tried them all from 3.6-3.11 including PyPy as well). All drives that I try to get usage data from get this error. This is the line of code I'm trying to run:
The
mount
parm I'm passing in has these values that all fail. The string is actually'A:\\'
but prints as:It doesn't make sense that the code would work on so many other versions of Python. I'm coming up with blanks so thought I would ask here...
THANK YOU for a fantastic package. psutil has been a huge part of my projects and provides constant feedback all day about my system. From a detailed look at each core to the overall CPU and RAM used, your work enables it all.
The text was updated successfully, but these errors were encountered: