chartify icon indicating copy to clipboard operation
chartify copied to clipboard

PNG is always a white square

Open Naraujo13 opened this issue 6 years ago • 4 comments

type: bug

Environment:

  • Chartify version(s): 2.6.0
  • Operating System(s): Windows
  • Python version(s): 3.7.1

What happened:

The PNG version of the charts always generate a white square image. The HTML works normally. image

What you expected to happen: It was expected to generate the png of the graphic.

How to reproduce it (as minimally and precisely as possible): Install the chrome driver and pipefy and try to generate any chart as png with jupyter

Naraujo13 avatar Aug 17 '19 06:08 Naraujo13

+1 I have the same issue. Can anyone help solving it? Saving to html does work though.

Robmosh91 avatar Apr 06 '20 13:04 Robmosh91

I have the same issue, still not able to figure it out.

cjslcjr avatar Feb 28 '21 21:02 cjslcjr

+1.

fanglinwang avatar May 31 '21 03:05 fanglinwang

Got this on my Ubuntu server 20.04

Wanted to do a bit debugging here.

screenshot of Chrome debugger connected to webdriver (added options.add_argument('--remote-debugging-port=9222')) image

To enable webdriver logs, do this (edit source code for chartify):

driver = webdriver.Chrome(
    options=options,
    # add this
    service_args=[
        "--verbose",
        "--log-path=/home/ubuntu/melcharter/webdriver.log",
    ],
)

webdriver logs:

[1632007907.997][DEBUG]: DevTools WebSocket Command: Page.navigate (id=16) 3A8C277E36F2C399656DAAE2ADBEFBC5 {
   "url": "file:////tmp/chartifyp70vb2rl.html"
}
[1632007908.003][DEBUG]: DevTools WebSocket Response: Page.navigate (id=16) 3A8C277E36F2C399656DAAE2ADBEFBC5 {
   "errorText": "net::ERR_FILE_NOT_FOUND",
   "frameId": "3A8C277E36F2C399656DAAE2ADBEFBC5",
   "loaderId": "BB149E8D4D35D3D49671161BD4FA9881"
}

So, chromium says that there is no such file, but simple stat /tmp/chartifyp70vb2rl.html shows that there is it.

If I change chart path right within chartify sourcecode from /tmp to /home, it works.

This code was patched https://github.com/spotify/chartify/blob/5ac3a88e54cf620389741f396cc19d60fe032822/chartify/_core/chart.py#L433-L471

Screenshot with code

The reason is snap.

Refs:

  • https://askubuntu.com/questions/1263843/how-to-allow-snap-applications-to-access-tmp-folder
  • https://askubuntu.com/questions/1184357/why-cant-chromium-suddenly-access-any-partition-except-for-home/1284975#1284975
  • https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1851250
  • https://forum.snapcraft.io/t/sharing-files-via-tmp/1613/21
  • https://askubuntu.com/questions/1215305/how-can-i-grant-a-snap-application-access-to-tmp-via-command-line

So I just fixed my issue with plots by uninstaling chromium snap version and installing unsnapped version:

  • sudo snap remove --purge chromium
  • Go to https://askubuntu.com/questions/1204571/how-to-install-chromium-without-snap

ColCh avatar Sep 19 '21 08:09 ColCh