zrguo commited on
Commit
03d23d7
·
unverified ·
2 Parent(s): 3f02d6c a8ef2df

Merge pull request #516 from ShanGor/main

Browse files

Fix the async issue while running on Windows

Files changed (1) hide show
  1. lightrag/kg/age_impl.py +4 -1
lightrag/kg/age_impl.py CHANGED
@@ -1,7 +1,7 @@
1
  import asyncio
2
  import inspect
3
  import json
4
- import os
5
  from contextlib import asynccontextmanager
6
  from dataclasses import dataclass
7
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
@@ -20,6 +20,9 @@ from lightrag.utils import logger
20
 
21
  from ..base import BaseGraphStorage
22
 
 
 
 
23
 
24
  class AGEQueryException(Exception):
25
  """Exception for the AGE queries."""
 
1
  import asyncio
2
  import inspect
3
  import json
4
+ import os, sys
5
  from contextlib import asynccontextmanager
6
  from dataclasses import dataclass
7
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
 
20
 
21
  from ..base import BaseGraphStorage
22
 
23
+ if sys.platform.startswith("win"):
24
+ import asyncio.windows_events
25
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
26
 
27
  class AGEQueryException(Exception):
28
  """Exception for the AGE queries."""