dexplo / dataframe_image

A python package for embedding pandas DataFrames as images into pdf and markdown documents
https://dexplo.org/dataframe_image
MIT License
282 stars 41 forks source link

CalledProcessError : returned non-zero exit status 21. #116

Closed eduardorco closed 1 month ago

eduardorco commented 3 months ago

Hi, everyday i use dataframe-image to process some images in my work. But today i started getting an error with all my codes using the module.

as an exemple, heres one of the codes i use:

def saldo_projetado(pasta_dos_dados):
    saldo_projetado_data = pd.read_excel(f"{pasta_dos_dados}Saldo_Projetado.xlsx", usecols=["Conta", "Assessor", "Total"])
    saldo_projetado_data["Assessor"] = saldo_projetado_data["Assessor"].apply(lambda x: "A" + str(x))
    saldo_projetado_data["Total"] = saldo_projetado_data["Total"].apply(lambda x: float(x.replace(",", '.')))
    saldo_projetado_data = saldo_projetado_data[saldo_projetado_data["Total"] < -50]
    saldo_projetado_formatado = saldo_projetado_data.reset_index(drop=True).style
    saldo_projetado_formatado = (saldo_projetado_formatado.set_properties(**{'text-align': 'left', 'border': '1px black solid !important'})
            .format({"Total": "R$ {:,.2f}"})
            .set_table_styles([dict(selector='th', props=[('text-align', 'center'), ('border', '1px black solid !important')])])
            .hide())
    dfi.export(saldo_projetado_formatado,f"{pasta_dos_dados}Saldo_projetado.png",chrome_path="C:\\Users\\eduar\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe")

But today, the code started giving me the following error: CalledProcessError: Command '['--enable-logging', '--disable-gpu', '--headless', '--crash-dumps-dir=C:\\Users\\eduar\\.dataframe_image\\tmpg6tmi7oy', '--force-device-scale-factor=1', '--window-size=1400,900', '--hide-scrollbars', '--screenshot=C:\\Users\\eduar\\.dataframe_image\\tmpg6tmi7oy\\temp.png', 'C:\\Users\\eduar\\.dataframe_image\\tmpg6tmi7oy\\temp.html']' returned non-zero exit status 21.

The path to chrome is right; Using dataframe-image-0.2.4 When i insert table_conversion='matplotlib', the error is gone. But i dont like the look of the image and i lose some settings in my image as well...

Kazekawa-azusa commented 3 months ago

A strange solution

"Don't open websites with chrrome" For my computer, I deal it just run the code with chrome is closing (without opening websites through chrome).

However, I got issue #115. The picture got cutted no matter the value of max_cols. (Is that means it's too big to be created?) The error of cutting image is solved after i insert table_conversion='matplotlib'.

#issue
import dataframe_image as dfi
import pandas as pd

df = pd.DataFrame({
    'a': [i for i in range(1,101)],
    'b': [i for i in range(1,101)],
    'c': [i for i in range(1,101)]
    })
dfi.export(df,'test.png',max_rows=100,fontsize=30)

test

zykEric commented 3 months ago

I get the same error today.Yesterday dataframe-image worked perfectly fine. 1724924006277

PaleNeutron commented 3 months ago

Does table_conversion='playwright' works?

I can not track every Chrome change, if playwright works then I'll check if this error still exist in next chrome version.

Kazekawa-azusa commented 3 months ago

Does table_conversion='playwright' works?

I can not track every Chrome change, if playwright works then I'll check if this error still exist in next chrome version.

It works perfectly.

haynja commented 1 month ago

hi I believe I have the same issue the fix for this is to change --headless to --headless=old in converter/browser/chrome_converter.py line 118

found out about the fix here: https://stackoverflow.com/a/78935135

I tested the change, which seemed to work

PaleNeutron commented 1 month ago

hi I believe I have the same issue the fix for this is to change --headless to --headless=old in converter/browser/chrome_converter.py line 118

found out about the fix here: https://stackoverflow.com/a/78935135

I tested the change, which seemed to work

Can you test again with a long(more than 1 screen height) dataframe?

eduardorco commented 1 month ago

hi I believe I have the same issue the fix for this is to change --headless to --headless=old in converter/browser/chrome_converter.py line 118

found out about the fix here: https://stackoverflow.com/a/78935135

I tested the change, which seemed to work

Works like a charm

PaleNeutron commented 1 month ago

Fixed in https://github.com/dexplo/dataframe_image/releases/tag/v0.2.5