Skip to content

Commit

Permalink
Solved svg2pdf conversion error if Inkscape is installed into the def…
Browse files Browse the repository at this point in the history
…ault path on a windows machine (#1469)

* fixed typo in major_version

* added an additional variable inkscape_path_string to enclose it in double spaces. Unsure if this change impacts Linux or Mac Systems. But solves my problem on windows

Co-authored-by: Adolph <adolphm@goldbeck.biz>
  • Loading branch information
MichaelAdolph and Adolph authored Jan 30, 2021
1 parent 78d58ab commit 5852762
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nbconvert/preprocessors/svg2pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ def _inkscape_version_default(self):

@default('command')
def _command_default(self):
major_verison = self.inkscape_version.split('.')[0]
export_option = ' --export-filename' if int(major_verison) > 0 else ' --export-pdf'
gui_option = '' if int(major_verison) > 0 else ' --without-gui'
inkscape_path_string = f'\"{self.inkscape}\"'
major_version = self.inkscape_version.split('.')[0]
export_option = ' --export-filename' if int(major_version) > 0 else ' --export-pdf'
gui_option = '' if int(major_version) > 0 else ' --without-gui'

return '{inkscape}{gui_option}{export_option}='.format(
inkscape=self.inkscape, export_option=export_option, gui_option=gui_option
inkscape=inkscape_path_string, export_option=export_option, gui_option=gui_option
) + '"{to_filename}" "{from_filename}"'

inkscape = Unicode(help="The path to Inkscape, if necessary").tag(config=True)
Expand Down

0 comments on commit 5852762

Please sign in to comment.