Migrating to 6.0¶
Breaking changes¶
disk_partitions() lost two fields¶
The maxfile and maxpath fields were removed, so positional
unpacking no longer works.
# old (ValueError)
device, mountpoint, fstype, opts, maxfile, maxpath = part
# new
device, mountpoint, fstype, opts = (
part.device, part.mountpoint, part.fstype, part.opts
)
process_iter() no longer checks for PID reuse¶
This makes it ~20× faster. If you relied on that check, call
Process.is_running() yourself.
# old
for p in psutil.process_iter():
print(p.pid)
# new
for p in psutil.process_iter():
if p.is_running():
print(p.pid)
Deprecations¶
Process.connections() renamed to Process.net_connections()¶
The old name still works but raises DeprecationWarning. It will be
removed in 9.0.
# old
p.connections(kind="tcp") # DeprecationWarning
# new
p.net_connections(kind="tcp")