Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Hidden dependency on which program #259

Copy link
Copy link
@Zaczero

Description

@Zaczero
Issue body actions

There seems to be a hidden dependency on the which program.

['which', 'wkhtmltopdf'], stdout=subprocess.PIPE).communicate()[0]

The way the binary gets discovered is unnecessarily complicated. Instead of starting an external binary (a whole new process), I recommend that the script simply checks the $PATH env variable. The syntax for it is very simple.

Sample solution:

    for directory in os.environ.get('PATH', '').split(os.pathsep):
        potential_path = os.path.join(directory, 'wkhtmltopdf')  # perhaps .exe on windows?
        if os.path.isfile(potential_path) and os.access(potential_path, os.X_OK):
            return potential_path

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.