Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pydevd-pycharm wrapper.
#!/usr/bin/env python
import os
import pydevd_pycharm as pycharm
except ImportError:
raise EnvironmentError(
"Please install PyCharm's PyDev support: pip install pydevd-pycharm"
def set_trace(host='localhost', port=None, *args, **kwargs):
`pydevd_pycharm.settrace` wrapper that mimics the interface used by many
other Python debuggers such as `pdb`, `pudb`, etc.
>>> import charmdb; charmdb.set_trace() # export PYCHARM_DEBUG_PORT=<number>
if port is None:
port = int(os.environ["PYCHARM_DEBUG_PORT"])
except KeyError:
raise EnvironmentError(
"Please set the environment variable: PYCHARM_DEBUG_PORT"
except ValueError:
raise EnvironmentError(
"PYCHARM_DEBUG_PORT must be a valid integer, got: {0}".format(
# Always step into this function call!
pycharm.settrace(host=host, port=port, stdoutToServer=True,
stderrToServer=True, *args, **kwargs) # Press F7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.