Bash on Windows - debug python file using Visual Code or Visual Studio

I have a python file in my Bash environment on Windows. Is it possible to debug it using Visual Code or Visual Studio?

Is it possible to connect the debugger to the python Linux version that exists in the Bash environment in the Windows environment?

+7
bash visual-studio windows-10 visual-studio-code windows-subsystem-for-linux
source share
2 answers

I think you have several options for this. If you are trying to debug a python file that was saved in your home directory on Bash on Windows, you can go to your home directory on Windows by going to "C: \ Users \ [Windows username] \ AppData \ Local \ lxss \ home \ [ubuntu username] \ ". You can then open any of your projects or files saved in your home folder in Ubuntu. You can even make a desktop shortcut or something to make access to this folder easier.

However, if you need an environment that you have on Bash for dependencies or python modules, another option is to install a GUI and Linux-compatible IDE for your Ubuntu and use Xming for Windows to run the IDE on your screen. A tutorial on how to do this can be found here .

If you need to debug a linux python program from Visual Studio, a simple google search gave it . I have not tried, but this seems to be the solution you are looking for. To connect over a network to Bash on Windows from Windows, use localhost for the host.

0
source share

It is best to move the file. Your normal Windows system is installed under /mnt/c .

You can simply copy it to your desktop by doing

cp (path to your file) /mnt/c/(your username)/Desktop

When you need to access or edit it from bash, just cd to that place (or wherever you choose to store it).

Another interesting idea: you can install cloud storage (e.g. google drive) through a fuse in linux, and then configure it on Windows. Copy it to python and you can edit it on Windows and access Linux if necessary. (Google is your friend here, look at google-drive-ocamlfuse or gdrivefs).

Hope this helps!

Jbit

0
source share

All Articles