Skip to content

Causes crash when you don't have Pygments installed #1

@kevinrenskers

Description

@kevinrenskers

Currently when you don't have Pygments installed, using SwiftPygments will crash.

Fatal error: 'try!' expression unexpectedly raised an error: Python exception: No module named 'pygments': file PythonKit/Python.swift, line 674

It would be great if it could use attemptImport and try?, and throw the resulting errors down to the user of the library, so errors can be caught and presented to the user, instead of crashing.

I'd love to include SwiftPygments as a dependency in my static site generator library, but I think it would be a lot better if import failures were handled gracefully 😅

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