fix: fixes windows compatibility in examples
This commit is contained in:
parent
704f2c68e2
commit
981f35c1e0
3 changed files with 24 additions and 3 deletions
|
|
@ -69,4 +69,9 @@ async def main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
setup_logging(logging.ERROR)
|
setup_logging(logging.ERROR)
|
||||||
asyncio.run(main())
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
try:
|
||||||
|
loop.run_until_complete(main())
|
||||||
|
finally:
|
||||||
|
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import logging
|
||||||
|
|
||||||
import cognee
|
import cognee
|
||||||
from cognee.api.v1.search import SearchType
|
from cognee.api.v1.search import SearchType
|
||||||
|
from cognee.shared.utils import setup_logging
|
||||||
|
|
||||||
# Prerequisites:
|
# Prerequisites:
|
||||||
# 1. Copy `.env.template` and rename it to `.env`.
|
# 1. Copy `.env.template` and rename it to `.env`.
|
||||||
|
|
@ -45,4 +47,10 @@ async def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
setup_logging(logging.ERROR)
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
try:
|
||||||
|
loop.run_until_complete(main)
|
||||||
|
finally:
|
||||||
|
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import cognee
|
import cognee
|
||||||
|
import logging
|
||||||
from cognee.api.v1.search import SearchType
|
from cognee.api.v1.search import SearchType
|
||||||
|
from cognee.shared.utils import setup_logging
|
||||||
|
|
||||||
# Prerequisites:
|
# Prerequisites:
|
||||||
# 1. Copy `.env.template` and rename it to `.env`.
|
# 1. Copy `.env.template` and rename it to `.env`.
|
||||||
|
|
@ -66,4 +68,10 @@ async def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
setup_logging(logging.ERROR)
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
try:
|
||||||
|
loop.run_until_complete(main())
|
||||||
|
finally:
|
||||||
|
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue