-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbconvert 5.6.1 failed with message: "nbconvert failed: Inkscape svg to pdf conversion failed" in Win 10 #1325
Comments
The alpha for nbconvert -- 6.0.0a4 -- should fix the issue with inkscape 1.0 on windows, if you want to give that a try. |
Thanks. I've upgraded an anaconda env to nbconvert 6.0.0.a4. After that I've got this error message when trying to export to pdf:
btw, exporting to pdf without SVG works in this environment. |
I did a little research with the svg2pdf.py of the above mentioned alpha and found the following: My registry contains the string value "C:\Program Files\Inkscape\bin\inkscape.exe,0" (without quotation marks). When you enter that text in a command line prompt, the trailing ",0" leads to
Second, the blank in "Program Files" causes problems. If I modify svg2pdf.py to remove the ",0" when getting the string from the registry, e.g., by inkscape = winreg.QueryValueEx(rkey, "")[0].split(',')[0] and change the command string from return '{inkscape}{gui_option}{export_option}='.format(
inkscape=self.inkscape, export_option=export_option, gui_option=gui_option
) + '"{to_filename}" "{from_filename}"' to return '"{inkscape}"{gui_option}{export_option}='.format(
inkscape=self.inkscape, export_option=export_option, gui_option=gui_option
) + '"{to_filename}" "{from_filename}"' , then svg conversion with inkscape works for me. As I don't know if these changes will work for all OS (and not only for my Win10), I'll leave it here for someone to pick it up, include it, and test it properly. |
@MSeal theoky was quicker. :) |
Ahh thanks for finding the existing issue 👍 I've been swamped and my free time has been limited so I'm not sure when I'll get to this. Would love to have a new contributor try to put this into a PR with a test improvement. |
Hi @theoky, I'm trying to follow your solution. Could you please explain how to locate the file |
I can find it on my machine here:
Hope that helps. |
Thank you so much. I've just found it. It's sad that the content of the file is changed and I'm unable to apply your method.
|
Thanks for creating the pull request. |
Is this merged? Should this be closed? I'm still getting this error in nbconvert 6.1.0 |
That helped, finally! |
This issue has been mentioned on Jupyter Community Forum. There might be relevant details there: https://discourse.jupyter.org/t/inkscape-error-when-converting-julia-notebook-to-pdf/13112/2 |
In the meantime I did an update to nbconvert 7.2.3 and installed inkscape 1.2.1 in a path without space. While the command string handling changed, the code for getting the inkscape exe path on Windows in the file svg2pdf.py still is inkscape = winreg.QueryValueEx(rkey, "")[0] and still returns
on two Win 10 machines (one German, one English), thus aborting the nbconvert process with
So I still need to patch this line it to inkscape = winreg.QueryValueEx(rkey, "")[0].split(',')[0] or some other code which removes the ",0" and then it works. I don't know if this only happens on my Win 10 machines or on all... |
Re-post. Is it really solved? |
This happens when trying to convert a notebook with svg graphics embedded.
I have a hunch that the svg2pdf.py code can not handle a blank in the program name of inkscape as it is the case on my machine ("C:\Program Files\Inkscape\bin\inkscape.exe"). Also the text before the exception "'C:\Program' is not recognized as an internal or external command, operable program or batch file." gives this impression.
Environment
Steps to reproduce
(Rather) minimal notebook: Gantt_Minimal_SVG.txt
Nbconvert version: 5.6.1
The text was updated successfully, but these errors were encountered: