Skip to content
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

Update svg2pdf.py to search the PATH for inkscape #1115

Merged
merged 1 commit into from
Oct 17, 2019

Conversation

rbeesley
Copy link
Contributor

Instead of relying on the registry to locate inkscape, for Python 3.3+,
use the shutil.which function to locate the file. If this fails because
inkscape is not in the path or if the version of Python is less than
3.3, then fall back to the existing methods. This has the advantage of
being a platform independent process as shutil.which is designed to be
platform agnostic. This PR fixes the problems seen in issue #139 and
#456 (as well as probably other issues), for resolving the path on
Windows. This doesn't invalidate the work in PR #1008, which may help
with the registry method, but I believe this change eliminates the need
for PR #1008 for most by utilizing a more standard approach. Where the
registry method is better is when inkscape is only in the registry and
not in the PATH, but finding the file in the PATH is bound to be more
resilient to change such as might happen if files on the disk are moved
and yet the registry key was not updated with the change, or the
registry key was left over and not removed from an old install. This is
intended to compliment the existing method rather than replace.

Instead of relying on the registry to locate inkscape, for Python 3.3+,
use the shutil.which function to locate the file. If this fails because
inkscape is not in the path or if the version of Python is less than
3.3, then fall back to the existing methods. This has the advantage of
being a platform independent process as shutil.which is designed to be
platform agnostic. This PR fixes the problems seen in issue jupyter#139 and
jupyter#456 (as well as probably other issues), for resolving the path on
Windows. This doesn't invalidate the work in PR jupyter#1008, which may help
with the registry method, but I believe this change eliminates the need
for PR jupyter#1008 for most by utilizing a more standard approach. Where the
registry method is better is when inkscape is only in the registry and
not in the PATH, but finding the file in the PATH is bound to be more
resilient to change such as might happen if files on the disk are moved
and yet the registry key was not updated with the change, or the
registry key was left over and not removed from an old install. This is
intended to compliment the existing method rather than replace.
Copy link
Contributor

@MSeal MSeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, though getting my windows setup working again for pdf export to test was a pain :P . Thanks for making the PR!

@MSeal MSeal merged commit b2250ef into jupyter:master Oct 17, 2019
@MSeal MSeal added this to the 5.6.1 milestone Oct 21, 2019
@MSeal MSeal mentioned this pull request Jul 2, 2020
@MSeal MSeal added this to the 5.6.1 milestone Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants