Forums

Where are the exported png files generated by my script saved?

My script involves:

  • Calling API and consolidating the data into a pandas dataframe
  • Converting and exporting the dataframe into a png file using dataframe_image library
  • A chatbot will send the png file to the user

When I run the script on my desktop, the png will be saved in my drive. But when I run on pythonanywhere, I am unsure where is my png file located at. Thus, my bot does not send any response to my users.

Any advice is appreciated, thank you.

See https://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/

Sorry Glenn, I should have been more specific and state the exception. I thought it's the file path that's causing the issue but I've tried the suggestion above but to no avail.

Here's the traceback. I'm met with a CalledProcessError but I don't have this issue when I'm running the script on my desktop.

Any idea why this might be so?

Traceback (most recent call last):   File "/home/kimjongbun/.local/lib/python3.10/site-packages/telegram/ext/_application.py", line 1184, in process_update
    await coroutine   File "/home/kimjongbun/.local/lib/python3.10/site-packages/telegram/ext/_basehandler.py", line 141, in handle_update
    return await self.callback(update, context)   File "/home/kimjongbun/sg-weather-telegram-bot.py", line 83, in handle_message
    response = handle_response(text)   File "/home/kimjongbun/sg-weather-telegram-bot.py", line 73, in handle_response
    dfi.export(four_day_df, '/user/kimjongbun/files/home/kimjongbun/SG 4 days weather.png')   File "/home/kimjongbun/.local/lib/python3.10/site-packages/dataframe_image/_pandas_accessor.py", line 142, in export
    img_str = converter(html)
    subprocess.run(   File "/home/kimjongbun/.local/lib/python3.10/site-packages/dataframe_image/converter/browser/base.py", line 166, in run
    im = self.screenshot(html)   File "/home/kimjongbun/.local/lib/python3.10/site-packages/dataframe_image/converter/browser/chrome_converter.py", line 138, in screenshot
    subprocess.run(   File "/usr/local/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['--enable-logging', '--disable-gpu', '--headless', '--crash-dumps-dir=/home/kimjongbun/tmp9md664c5', '--force-device-scale-factor=1', '--window-size=1400,900', '--hide-scrollbars', '--screenshot=/home/kimjongbun/tmp9md664c5/temp.png', '/home/kimjongbun/tmp9md664c5/temp.h tml']' returned non-zero exit status 1.

It looks like an issue with using dataframe-image on PythonAnywhere. I found a previous forum post where a user suggests using df2img instead. Maybe you can try if that works.

Thank you nkahr!

Let us know if it worked for you!