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

[BUG] CodeInterpreterTool cannot handle mutli-line code #158

Open
MahlerTom opened this issue Dec 24, 2024 · 0 comments
Open

[BUG] CodeInterpreterTool cannot handle mutli-line code #158

MahlerTom opened this issue Dec 24, 2024 · 0 comments

Comments

@MahlerTom
Copy link
Contributor

MahlerTom commented Dec 24, 2024

When using CodeInterpreterTool, if the code inserted includes \n an error is thrown.
This happens a lot when using the tool with agent that produce complex multi-line code as input.

Example:

from crewai_tools import CodeInterpreterTool

code = """print("Hello, ")
print("World!")"""

print(CodeInterpreterTool().run_code_in_docker(code=code, libraries_used=[]))

Error:

Something went wrong while running the code: 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'Hello' is not defined

sys:1: ResourceWarning: unclosed <socket.socket fd=3, family=2, type=1, proto=0, laddr=('127.0.0.1', 50577), raddr=('127.0.0.1', 50574)>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
@MahlerTom MahlerTom changed the title [BUG] CodeInterpreterTool cannot handle mutli-line code [BUG] CodeInterpreterTool cannot handle mutli-line code Dec 24, 2024
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