Kwanghee Lee
@cfakwanghee9541
Reviews Written
-
Average Rating
-
Posts
Q&A
asyncio.run() cannot be called from a running event loop ์๋ฌ ์ง๋ฌธ ๋๋ฆฝ๋๋ค
https://stackoverflow.com/questions/56154176/runtimeerror-asyncio-run-cannot-be-called-from-a-running-event-loop-in-spyd์ฐพ๋ค๊ฐ ์ฌ๊ธฐ๊น์ง ๊ฐ๋ค์... ์๋์ฝ๋ค ์ฐ๋๊ฒ ๋ฌธ์ ์ธ๊ฑฐ ๊ฐ์๋ฐ ๊ทธ๋๋ ๋ ์๋ก์ด ์๋ฌ๊ฐ.. ์๋ฌธ์๋ต ํฉ๋๋ค. ์ฐพ์ผ์๋ ๋ถ๋ค ์์๊น๋ด ๋จ๊ฒจ๋์ต๋๋ค.
- Likes
- 0
- Comments
- 4
- Viewcount
- 3.9K
Q&A
asyncio.run() cannot be called from a running event loop ์๋ฌ ์ง๋ฌธ ๋๋ฆฝ๋๋ค
ํ๋ก๊ทธ๋จ์ ์๋์ฝ๋ค ์คํ์ด๋ ์ฐ๊ณ ์๊ตฌ์ ์ฑgpt์ ๋ฌผ์ด๋ณด๋ ๋น์ ๋ง์ด ๋ง์์. asyncio.run()๊ธฐ์กด ์ด๋ฒคํธ ๋ฃจํ ๋ด์์๋ ํธ์ถํ ์ ์์ต๋๋ค. ์ด ์ ํ์ ์๊ธฐ์น ์์ ๋์์ผ๋ก ์ด์ด์ง ์ ์๋ ์ค์ฒฉ๋ ์ด๋ฒคํธ ๋ฃจํ๋ฅผ ์ค์๋ก ์์ฑํ๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํด ์ ์ฉ๋ฉ๋๋ค.์ด๋ฏธ ์ด๋ฒคํธ ๋ฃจํ๊ฐ ์คํ ์ค์ธ ํ๊ฒฝ(์: Jupyter ๋ ธํธ๋ถ ๋๋ ๋ํํ Python ์ ธ)์์ ์ด ์ฝ๋๋ฅผ ์คํํ๋ ๊ฒฝ์ฐ ์ด๋ฒคํธ ๋ฃจํ๋ฅผ ์๋์ผ๋ก ๋ง๋ค๊ณ ์คํํด์ผ ํฉ๋๋ค.์ด๋ฌํ ํ๊ฒฝ์์ ์๋ํ๋๋ก ์ฝ๋๋ฅผ ์์ ํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.import asyncio async def main(): await asyncio.sleep(1) print('hello') # If there's an event loop running, get it loop = asyncio.get_event_loop() # Schedule the coroutine to run in the existing event loop loop.run_until_complete(main())๊ทธ๋๋ ์๋ฌ๊ฐ ๋น๋๋คRuntimeError: This event loop is already running
- Likes
- 0
- Comments
- 4
- Viewcount
- 3.9K
Q&A
ํ ๋ ๊ทธ๋จ ์ผ๋ ๋ฉ์ธ์ง API 4,096๋ฐ์ดํธ ๋์์ ์ ์ก ๋ถ๊ฐ
์ฒ์๋ถํฐ joinํด์ ๋ฉ์ธ์ง๋ฅผ ๋ณด๋ด์ง ์๊ณ title_list ๋ฆฌ์คํธ๋ฅผ 4์ฒ ๋ฐ์ดํธ ์๋๊ฒ ์ฌ๋ผ์ด์ฑ ํ๊ณ , ์ฌ๋ผ์ด์ฑ ํ ๋ฆฌ์คํธ๋ฅผ ์กฐ์ธ์์ผ์ ํด๊ฒฐ ํ์ต๋๋ค.ํน์ ์ด๊ฑฐ ์ฐพ์๋ณด์๋ ๋ถ๋ค ์์๊น ์ถ์ด ๋จ๊น๋๋ค.
- Likes
- 0
- Comments
- 3
- Viewcount
- 756
Q&A
ํ ๋ ๊ทธ๋จ ์ผ๋ ๋ฉ์ธ์ง API 4,096๋ฐ์ดํธ ๋์์ ์ ์ก ๋ถ๊ฐ
์ผ๋จ ๋ฉ์ธ์ง ๋ณ์๊ฐ str์ด๋ ์ด๊ฑธ ๊ธ์์ ๋จ์๋ก ์ชผ๊ฐ์ ์ ์กํ๋ ๋ฐฉ๋ฒ์ ์๊ฐํด๋ดค๋๋ฐ ๋ญ๊ฐ ์ข ์ข์๊ฑฐ ์์๊น์
- Likes
- 0
- Comments
- 3
- Viewcount
- 756




