Skip to content

Add a hint when failing to import a module in cases where a user might want to use a relative import#40984

Merged
KristofferC merged 2 commits intomasterfrom
kc/hint_module
Sep 30, 2021
Merged

Add a hint when failing to import a module in cases where a user might want to use a relative import#40984
KristofferC merged 2 commits intomasterfrom
kc/hint_module

Conversation

@KristofferC
Copy link
Copy Markdown
Member

Fixes #40959

julia> module Foo
           a = 5
           export a
       end
Main.Foo

julia> using Foo
ERROR: ArgumentError: Package Foo not found in current path, maybe you meant `import/using .Foo`. Otherwise, run `import Pkg; Pkg.add("Foo")` to install the Foo package.
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./REPL[1]:19

@IanButterworth
Copy link
Copy Markdown
Member

Seems good to me!

@KristofferC KristofferC merged commit 203d234 into master Sep 30, 2021
@KristofferC KristofferC deleted the kc/hint_module branch September 30, 2021 17:51
@DilumAluthge
Copy link
Copy Markdown
Member

This is a nice quality-of-life improvement. Could we backport it to 1.6 and 1.7 (not 1.7.0, but instead 1.7.1)?

LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
…t want to use a relative import (JuliaLang#40984)

* Add a hint when failing to import a module in cases where a user might want to use a relative import
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
…t want to use a relative import (JuliaLang#40984)

* Add a hint when failing to import a module in cases where a user might want to use a relative import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hint or helper at REPL for using/importing non-package modules

4 participants