Skip to content

FileNotFoundError: [Errno 2] No such file or directory: '/exports/charts/7f792cad-32b6-4385-b334-585a5d46e23a.png' #1458

Open
@Catherineasdzz

Description

System Info

pandasai 2.3.0
ubuntu 0.20.04.1
python 3.9

🐛 Describe the bug

I looked up similar problems in the past and found that the drawing problems of GPT-3.5 and BambooLLM have been solved, but I still have the same problem when I run the code.

import os
import pandas as pd
from pandasai import Agent

# Sample DataFrame
sales_by_country = pd.DataFrame({
    "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
    "revenue": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})

os.environ["PANDASAI_API_KEY"] = "MY_API_KEY"

agent = Agent(sales_by_country,config={
    "save_charts": True,
    "open_charts": True,
    "save_charts_path": "/exports/charts",
    })
response = agent.chat('Which are the top 5 countries by sales?')
r2 = agent.chat(
    "Plot the histogram of countries showing for each one the gd. Use different colors for each bar",
)
Traceback (most recent call last):
  File "/root/miniconda3/envs/DataAI/lib/python3.9/site-packages/pandasai/pipelines/chat/generate_chat_pipeline.py", line 333, in run
    output = (
  File "/root/miniconda3/envs/DataAI/lib/python3.9/site-packages/pandasai/pipelines/pipeline.py", line 137, in run
    raise e
  File "/root/miniconda3/envs/DataAI/lib/python3.9/site-packages/pandasai/pipelines/pipeline.py", line 101, in run
    step_output = logic.execute(
  File "/root/miniconda3/envs/DataAI/lib/python3.9/site-packages/pandasai/pipelines/chat/code_execution.py", line 133, in execute
    {"content_type": "response", "value": ResponseSerializer.serialize(result)},
  File "/root/miniconda3/envs/DataAI/lib/python3.9/site-packages/pandasai/responses/response_serializer.py", line 35, in serialize
    with open(result["value"], "rb") as image_file:
FileNotFoundError: [Errno 2] No such file or directory: '/exports/charts/8998e704-c205-46ed-9a6c-3c23a031f93c.png'

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions