Skip to content

BUG: Python SDK not working in VS Code stable terminal but works fine in Command Prompt in Windows #384

@softchris

Description

@softchris

Given:

  • Installed Copilot CLI
  • Python SDK
  • OS: Windows
  • VS Code 1.109.0
import asyncio
from copilot import CopilotClient

async def main():
    client = CopilotClient()
    await client.start()

    session = await client.create_session({"model": "gpt-4.1"})
    response = await session.send_and_wait({"prompt": "What is 2 + 2?"})

    print(response.data.content)

    await client.stop()

asyncio.run(main())

DON'T WORK VS Code terminal:

File "C:\Users<user>\AppData\Roaming\uv\python\cpython-3.12.11-windows-x86_64-none\Lib\asyncio\tasks.py", line 520, in wait_for
   return await fut
          ^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
Reinstall GitHub Copilot CLI? (y/N):
Reinstall GitHub Copilot CLI? (y/N):
Reinstall GitHub Copilot CLI? (y/N):
Reinstall GitHub Copilot CLI? (y/N):

WORKS Command prompt:

Works!!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions