Skip to content

Commit f9cc36f

Browse files
authored
fix: handle RuntimeError when checking if we can use pdf split mode (#145)
Certain environments throw a `RuntimeError: There is no current event loop in thread 'asyncio_0'` when we try to check if we're able to use the splitting code. In this case, return False so we can fallback to non split mode. Once this is merged, I can regenerate the client to publish 0.25.4.
1 parent f927744 commit f9cc36f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/unstructured_client/_hooks/custom/split_pdf_hook.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def context_is_uvloop():
7979
import uvloop # pylint: disable=import-outside-toplevel
8080
loop = asyncio.get_event_loop()
8181
return isinstance(loop, uvloop.Loop)
82-
except ImportError:
82+
except (ImportError, RuntimeError):
8383
return False
8484

8585
def get_optimal_split_size(num_pages: int, concurrency_level: int) -> int:

0 commit comments

Comments
 (0)