Open eliassal opened 3 years ago
arepl_dump is not meant to be run from the command line - it only works in AREPL.
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 🤔
Yes, good idea is not to generate the suiglly red line and leave us run commands without errors. Can this be fixed?
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.
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
@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
@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.
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 finally
seems 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
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 getTo Reproduce Steps to reproduce the behavior:
Expected behavior it should work according to what is mentioned at https://marketplace.visualstudio.com/items?itemName=almenon.arepl
Screenshots
Other Information (please complete the following information):