Update svg2pdf.py to search the PATH for inkscape #1115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.