From c7e635dd06824894913ea2ee8ec3ef8c4eab3779 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Mon, 17 Apr 2023 09:51:26 +0200 Subject: [PATCH] fix #2238 if cwd() cannot be determined always return "" instead of None --- psutil/_psbsd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index b77a9d6888..ec02430581 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -835,7 +835,7 @@ def cwd(self): # sometimes we get an empty string, in which case we turn # it into None if OPENBSD and self.pid == 0: - return None # ...else it would raise EINVAL + return "" # ...else it would raise EINVAL elif NETBSD or HAS_PROC_OPEN_FILES: # FreeBSD < 8 does not support functions based on # kinfo_getfile() and kinfo_getvmmap()