JuliaPy / JuliaPy/PyCall.jl

detect ModuleNotFoundError in pyimport

Open
#645 2 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Currently, we print `The Python package foo could not be found by pyimport` when [*any* ImportError](https://github.com/JuliaPy/PyCall.jl/blob/master/src/PyCall.jl#L490) is thrown by `pyimport`. We should only print this on a `ModuleNotFoundError`, as otherwise it is misleading.

Note that we can only do this in Python ≥ 3.6 (https://github.com/python/cpython/commit/c943265ba56e7ce7e2fe79fdecfc6670e10e5467). I guess in earlier versions we could check for `"No module named"` in the `ImportError` string?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.