Skip to content

Instantly share code, notes, and snippets.

@joshlk
Created March 9, 2021 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshlk/3c0ebb54f37080e4889e7ac94f378125 to your computer and use it in GitHub Desktop.
Save joshlk/3c0ebb54f37080e4889e7ac94f378125 to your computer and use it in GitHub Desktop.
Remove debugging with pycharm

Steps to debug a program on a remote machine without using remote deployment.

  1. Start the debug server in pycharm and specify a port such as 21000
  2. SSH remote forward a port e.g. ssh host -R 21000:localhost:21000
  3. Start a Python process and insert the following line (first pip install pydevd-pycharm`):
import pydevd_pycharm; pydevd_pycharm.settrace('localhost', port=21000, stdoutToServer=True, stderrToServer=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment