Skip to content
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

ModuleNotFoundError: No module named arepl_dump #379

Open
eliassal opened this issue Mar 25, 2021 · 8 comments
Open

ModuleNotFoundError: No module named arepl_dump #379

eliassal opened this issue Mar 25, 2021 · 8 comments

Comments

@eliassal
Copy link

Describe the bug
I copied the code for Misc/Dumping, once pasted, VSC puts a red suiggly line under "arepl_dump" in
from arepl_dump import dump
I hit run without debug, I get variables dumped on the right hand side but in terminal I get

File "c:\Projects\Python\10 Py Apps10Days\dumpallvar.py", line 1, in
from arepl_dump import dump
ModuleNotFoundError: No module named 'arepl_dump'

To Reproduce
Steps to reproduce the behavior:

  1. Described above

Expected behavior
it should work according to what is mentioned at https://marketplace.visualstudio.com/items?itemName=almenon.arepl

Screenshots
AREPL-VSC

Other Information (please complete the following information):

  • OS: Windows10 64bit
  • Python Version 3.9
@Almenon
Copy link
Owner

Almenon commented Mar 26, 2021

arepl_dump is not meant to be run from the command line - it only works in AREPL.

@Almenon
Copy link
Owner

Almenon commented Mar 26, 2021

That being said it would probably still be good to have it not cause an error when running from the command line, so users can run a script from the shell without having to comment the import out 🤔

@eliassal
Copy link
Author

Yes, good idea is not to generate the suiglly red line and leave us run commands without errors. Can this be fixed?

@Almenon
Copy link
Owner

Almenon commented Mar 27, 2021

It can, but I don't work that much on this project anymore. You or someone else is welcome to be submit a PR if you wish.

@vbrozik
Copy link

vbrozik commented Dec 1, 2021

It would be great to get rid of the reported problem. For example if Pylance is being used (I think it is the default in VS Code) it shows the red underline and this message in the problems report:

Import "arepl_dump" could not be resolved

Of course constantly reported problems make the otherwise extremely useful problem report hard to use.

For Pylance a simple workaround could be to ignore the problem by appending a directive:

from arepl_dump import dump     # type: ignore

@eliassal
Copy link
Author

eliassal commented Dec 1, 2021

@vbrozik , not sure what you suggest resolves the issue. I have the directive, when I hit the button run in VSCode, still getting

ModuleNotFoundError: No module named 'arepl_dump',

as you can notice in the snapshot

arepl-Dump

@vbrozik
Copy link

vbrozik commented Dec 1, 2021

@eliassal, I was reacting just to:

good idea is not to generate the suiglly red line

Of course the directive just deactivates the Pyright/Pylance check (inside VS Code) to get rid of the red line. It will not make the code run outside of AREPL.

@bernhardkaindl
Copy link

bernhardkaindl commented Mar 24, 2022

I've had this error even inside vscode, at least when using a venv. For this and the case when run outside of vscode, this ìmport appears to help (yes, the finallyseems to be needed as well, otherwise I get a new editor with these lines in it as an Unitled file an of course arepl does not work then:

try:
    from arepl_dump import dump  # type: ignore
except ModuleNotFoundError:
    def dump() -> None:
        return
finally:
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants