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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2021

Conversation

KristofferC
Copy link
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
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
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