diff --git a/src/poetry/utils/appdirs.py b/src/poetry/utils/appdirs.py index 2d2f3f21985..7187f14c55a 100644 --- a/src/poetry/utils/appdirs.py +++ b/src/poetry/utils/appdirs.py @@ -208,7 +208,9 @@ def _get_win_folder_with_ctypes(csidl_name: str) -> str: }[csidl_name] buf = ctypes.create_unicode_buffer(1024) - windll = ctypes.windll # type: ignore[attr-defined] + if sys.platform != "win32": # for mypy + return "" + windll = ctypes.windll windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf) # Downgrade to short path name if have highbit chars. See