Hylke
Hylke
MModular
Created by obadakhalili on 4/8/2024 in #questions
Debugging Issue with Mojo's VSCode Debugger
Oh wow, that actually worked! The mojo debugger in vscode is pretty cool. 🤩 Thanks you so much for the pointers and keep up the good work!
38 replies
MModular
Created by obadakhalili on 4/8/2024 in #questions
Debugging Issue with Mojo's VSCode Debugger
Hi Walter, Thanks for your prompt response. I only have the tab Mojo; no Mojo (Nightly) tab like in your screenshot. At any rate, attached are the contents. Note that no additional output appears when I run mojo debug --vscode -I . './my/file.:fire:'
38 replies
MModular
Created by obadakhalili on 4/8/2024 in #questions
Debugging Issue with Mojo's VSCode Debugger
Thanks for getting in touch! I can confirm that the command line debugger:
mojo debug --vscode -I . './my/file.🔥'
mojo debug --vscode -I . './my/file.🔥'
indeed works. However, I wasn't able to get it to work with the --vscode flag:
$ mojo debug --vscode -I . './my/file.:fire:'
[INFO] Additional logs can be found in /tmp/mojo-debug-rpc-logs-7a3828.txt. Please include them when reporting bugs.

mojo: error: couldn't connect to any VSCode windows. You might need to restart the IDE or file a bug.
$ mojo debug --vscode -I . './my/file.:fire:'
[INFO] Additional logs can be found in /tmp/mojo-debug-rpc-logs-7a3828.txt. Please include them when reporting bugs.

mojo: error: couldn't connect to any VSCode windows. You might need to restart the IDE or file a bug.
Looking in the indicated log file, I find:
Error: can't connect to the RPC server with port 12355: Connection refused.
Error: can't connect to the RPC server with port 12355: Connection refused.
38 replies
MModular
Created by obadakhalili on 4/8/2024 in #questions
Debugging Issue with Mojo's VSCode Debugger
I am actually having the same problem. I rely on the -I ./ argument to run mojo -I ./ module/my-file.mojo. I tried setting the variable in launch.json in vs code as suggested:
{
"configurations": [
{
...
"env": [
"MODULAR_MOJO_NIGHTLY_IMPORT_PATH=${workspaceFolder}/path/to/."
],
...
}
]
}
{
"configurations": [
{
...
"env": [
"MODULAR_MOJO_NIGHTLY_IMPORT_PATH=${workspaceFolder}/path/to/."
],
...
}
]
}
But without success, I didn't get the debugger to work. Incidentally, the environment variable trick also doesn't work manually directly from the command line:
export MODULAR_MOJO_NIGHTLY_IMPORT_PATH=/absolute/path/to/."
mojo module/my-file.mojo
export MODULAR_MOJO_NIGHTLY_IMPORT_PATH=/absolute/path/to/."
mojo module/my-file.mojo
Any thoughts?
38 replies
MModular
Created by Hylke on 5/9/2024 in #questions
Mojo test
Solved! Thanks @bunny , removing the __init__.mojo helped fixed the problem.
7 replies