community[patch]: Fix pwd import that is not available on windows (#17532)

- **Description:** Resolving problem in
`langchain_community\document_loaders\pebblo.py` with `import pwd`.
`pwd` is not available on windows. import moved to try catch block
  - **Issue:** #17514
This commit is contained in:
Jan Cap 2024-02-14 22:45:10 +01:00 committed by GitHub
parent 91bcc9c5c9
commit 7ae3ce60d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,6 @@
import logging
import os
import pwd
import uuid
from http import HTTPStatus
from typing import Any, Dict, Iterator, List
@ -260,6 +259,8 @@ class PebbloSafeLoader(BaseLoader):
str: Name of owner.
"""
try:
import pwd
file_owner_uid = os.stat(file_path).st_uid
file_owner_name = pwd.getpwuid(file_owner_uid).pw_name
except Exception: