Skip to content

How to debug Python app running on a Raspberry Pi from Visual Studio Code on Linux, Windows and macOS

Notifications You must be signed in to change notification settings

gloveboxes/Remote-debug-Python-on-Raspberry-Pi-from-Visual-Studio-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Remote-debug-Python-on-Raspberry-Pi-from-Visual-Studio-Code

Tested Raspberry Pi

Author dglover@microsoft.com
Platform Raspberry Pi
Language Tested with Python 3
Visual Studio Code Version 1.25.1
Date 28 July 2018

Install Visual Studio Code

  1. Install Visual Studio Code
  2. Install the Python Extension

Install ptvsd version 3 on developer desktop and Raspberry Pi

pip3 install ptvsd==3.0.0

See Python Remote Debugging for more information.

Authenticate Raspberry Pi with SSH Keys

ssh-keygen -t rsa
ssh-copy-id pi@xxx.xxx.xxx.xxx

How To Set Up SSH Keys

Remote Mount Raspberry Pi File System

On your developer desktop machine mount the Raspberry Pi file system and create your project on this mounted drive - ie on the Raspberry Pi.

For Linux

sudo apt-get install sshfs
sudo mkdir /mnt/rpi3plus
sudo sshfs -o allow_other -o IdentityFile=~/.ssh/id_rsa pi@xxx.xxx.xxx.xxx:/home/pi /mnt/rpi3plus

For Windows and macOS see How To Use SSHFS to Mount Remote File Systems Over SSH

Debug your Project

  1. See tasks.json for two tasks. One to start the python app on the Raspberry Pi, the other to close when you detach the Python debugger.
  2. See launch.json - Python Raspberry Pi: Attach. Select and run from Debug tab

About

How to debug Python app running on a Raspberry Pi from Visual Studio Code on Linux, Windows and macOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published