mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 08:58:48 +00:00
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:
parent
91bcc9c5c9
commit
7ae3ce60d2
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pwd
|
|
||||||
import uuid
|
import uuid
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Any, Dict, Iterator, List
|
from typing import Any, Dict, Iterator, List
|
||||||
@ -260,6 +259,8 @@ class PebbloSafeLoader(BaseLoader):
|
|||||||
str: Name of owner.
|
str: Name of owner.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
import pwd
|
||||||
|
|
||||||
file_owner_uid = os.stat(file_path).st_uid
|
file_owner_uid = os.stat(file_path).st_uid
|
||||||
file_owner_name = pwd.getpwuid(file_owner_uid).pw_name
|
file_owner_name = pwd.getpwuid(file_owner_uid).pw_name
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
Reference in New Issue
Block a user