Skip to content

The agent engineering platform.

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

Jan Cap7ae3ce60d2f5
diff --git a/libs/community/langchain_community/document_loaders/pebblo.py b/libs/community/langchain_community/document_loaders/pebblo.py
index e66e5ddc30..0875335ac1 100644
--- a/libs/community/langchain_community/document_loaders/pebblo.py
+++ b/libs/community/langchain_community/document_loaders/pebblo.py
@@ -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: