Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm trying to run the code on Windows 11 #138

Open
ForwardForward opened this issue Oct 21, 2023 · 0 comments
Open

I'm trying to run the code on Windows 11 #138

ForwardForward opened this issue Oct 21, 2023 · 0 comments

Comments

@ForwardForward
Copy link

I'm trying to run the code on Windows 11:

from codeinterpreterapi import CodeInterpreterSession

OPENAI_API_KEY="sk-my Open AI KEY"

async def main():
# create a session
session = CodeInterpreterSession(openai_api_key=OPENAI_API_KEY, model="gpt-3.5-turbo")
await session.astart()

# generate a response based on user input
response = await session.generate_response(
    "Plot the bitcoin chart of 2023 YTD"
)

# output the response (text + image)
print("AI: ", response.content)
for file in response.files:
    file.show_image()

# terminate the session
await session.astop()

if name == "main":
import asyncio
# run the async function
asyncio.run(main())

I get an error:

C:\Users\igorb\anaconda3\envs\agents\python.exe E:\pet\agents\codeinterpreter.py
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:265: RuntimeWarning: coroutine 'WebSocketCommonProtocol.send' was never awaited
self.ws.send(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "E:\pet\agents\codeinterpreter.py", line 75, in
asyncio.run(main())
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "E:\pet\agents\codeinterpreter.py", line 59, in main
response = await session.generate_response(
TypeError: object CodeInterpreterResponse can't be used in 'await' expression
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:512: RuntimeWarning: coroutine 'Process.wait' was never awaited
Exception ignored in: <function LocalBox.del at 0x0000024808BE3A30>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 567, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 526, in stop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 783, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 673, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\windows_events.py", line 315, in init
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 639, in init
ImportError: sys.meta_path is None, Python is likely shutting down
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002480AEC1D50>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002480AEE0E80>, 351431.296)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002480AEC1BD0>
Exception ignored in: <function BaseSubprocessTransport.del at 0x000002487F1D6DD0>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 126, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 104, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 109, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 753, in call_soon
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed

Process finished with exit code 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant