Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Saving to .svg on Windows 10: JSONDecodeError #97

Closed
gregorhd opened this issue Aug 6, 2021 · 6 comments
Closed

Saving to .svg on Windows 10: JSONDecodeError #97

gregorhd opened this issue Aug 6, 2021 · 6 comments

Comments

@gregorhd
Copy link

gregorhd commented Aug 6, 2021

Hi there, even after reading the instructions multiple times, I'm still not able to save a geoshapes-based chart to .svg with altair_saver on Windows 10 (executing in VSCode-Python). I'm getting this error reported elsewhere when calling both chart.save("test.svg", webdriver='firefox') as well as chart.save("test.svg", webdriver='chrome'):

JSONDecodeError: Expecting value: line 2 column 1 (char 2)

My relevant package versions are

altair 4.1.0
altair_saver 0.5.0
vega 3.5.0
vega-cli 5.17.0             
vega-lite-cli 4.17.0               
selenium 3.141.0
python-chromedriver-binary 92.0.4515.43.0

My Chrome browser is version 92.0.4515.131.

I added the path to a chromedriver.exe to the Path environment variable (in the system variables). Calling print(os.environ) from within my Python environment also shows this path clearly being listed.

I know this package hasn't been tested for Windows, but Is there anything else I could try to get this to work?

Thanks a million!

@sparisi
Copy link

sparisi commented Jan 29, 2022

I am having the exact same problem. Any news on that? @gregorhd did you find a solution? Thanks!

@gregorhd
Copy link
Author

gregorhd commented Jan 29, 2022 via email

@sparisi
Copy link

sparisi commented Jan 29, 2022

Got it, thanks anyway.
Btw, I partially fixed the low-quality problem by manually setting height and width of my chart to some large values, but I have to manually rescale everything else as well (labels, fonts, ticks, ...). And it doesn't work in some cases (for example with resolve_scale(x='independent')).
It is something, but saving directly in high-res would be much better .

@gregorhd
Copy link
Author

gregorhd commented Jan 29, 2022 via email

@Tigxy
Copy link

Tigxy commented Sep 20, 2022

Hi there!
I think I had quite a similar problem recently... The answer to a related issue has helped me fix it:

try npm install -g vega vega-cli vega-lite canvas

Sven-Ritzmann added a commit to juliankulinsky/adst that referenced this issue Dec 9, 2022
* adjusted Figures and numbers
* altair saver -> has trouble saving pngs on windows see: altair-viz/altair_saver#97
Sven-Ritzmann added a commit to juliankulinsky/adst that referenced this issue Dec 9, 2022
* added every png manually because the altair saver modle has bugs if you use it on windows
* see bug: altair-viz/altair_saver#97
@joelostblom
Copy link
Member

Since Altair 5.2, the functionality of Altair Saver is now available in Altair via the vl-convert package. Most of the functionality has been available since 5.0, and the main addition in 5.2 was PDF export. See the docs on how to save charts for more details

We are going to archive this repo, so I'm closing all the open issues and PRs before doing so. Try out the new options for saving charts mentioned above and if you run into issues, please open an issue directly in the altair or vl-convert repo.

@joelostblom joelostblom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants