Skip to content

Commit

Permalink
Emit more accurate error message (JuliaPy#760)
Browse files Browse the repository at this point in the history
* Emit more accurate error message

Until issue JuliaPy#645 is resolved, this is a  measure to not mislead the user.

* Fix test
  • Loading branch information
goretkin authored Jul 28, 2020
1 parent 064cf66 commit c411ea0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PyCall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function pyimport(name::AbstractString)
if pyisinstance(e.val, @pyglobalobjptr(:PyExc_ImportError))
# Expand message to help with common user confusions.
msg = """
The Python package $name could not be found by pyimport. Usually this means
The Python package $name could not be imported by pyimport. Usually this means
that you did not install $name in the Python version being used by PyCall.
"""
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ const PyInt = pyversion < v"3" ? Int : Clonglong
ex
end
@test ex isa PyCall.PyError
@test occursin("could not be found by pyimport", ex.msg)
@test occursin("could not be imported by pyimport", ex.msg)
# Make sure we are testing ModuleNotFoundError here:
if PyCall.pyversion >= v"3.6"
@test pyisinstance(ex.val, pybuiltin("ModuleNotFoundError"))
Expand Down

0 comments on commit c411ea0

Please sign in to comment.