PyCharm 4.0.4 Help

Run/Debug Configuration: Python Remote Debug Server

Use the remote debug configuration to launch the debug server. Refer to the Remote Debugging topic for additional information.

Item Description
Name In this text box, specify the name of the current run/debug configuration.
Update your script This section contains vital information required to prepare for remote debugging.
Add pycharm-debug.egg from the debug-eggs directory under PyCharm installation to the Python path. See procedure description in Remote Debugging.
Add the following import statement Copy the import statement from this read-only field, and paste it in your local script:

import pydevd

Add the following command to connect to the debug server Copy the command-line statement below, and paste it to your local script.

pydevd.settrace(<host name>, port=<port number>)

  • <host name> is taken from the Local host name field of this debug configuration.
  • <port number> is the number taken from the Port field of this debug configuration, or, if it has not been specified, some random number written to the console.

Note that the parameters of this command depend on the settings specified in this page. The command with the default settings is:

pydev.pydevd.settrace('localhost', port=$SERVER_PORT,stdoutToServer=True,stderrToServer=True)

which corresponds to the host name 'localhost', port number 0, selected check boxes Redirect output to console and Suspend after connect.

Local host name Specify the name of the local host, by which the IDE is accessible from the remote host. This host name will be automatically substituted to the command line. By default, localhost is used.
Port Specify the port number, which will be automatically substituted to the command line. If the default post number (0) is used, then PyCharm substitutes an arbitrary number to the command line at each launch of this debug configuration; if you specify any other value, it will be used permanently.
Path mappings Use this field to create mappings between the local and remote paths. Clicking the browse button browseButton results in opening Edit Path Mappings dialog box, where you can add new path mappings, and delete the selected ones.
Redirect output to console If this check box is selected, the output and error streams will be redirected to the PyCharm console, and the command line is complemented with the stdoutToServer=True, stderrToServer=True
Suspend after connect If this check box is selected, the debugger will suspend immediately after connecting to the IDE, on the next line after the settrace call.
If this check box is not selected, the debugger will only suspend upon hitting a breakpoint, or clicking stop, and the command line is complemented with suspend=False


Item Shortcut Description
add Alt+Insert Click this button to add a new configuration to the list.
delete Alt+Delete Click this button to remove the selected configuration from the list.
copy Ctrl+D Click this button to create a copy of the selected configuration.
settings Edit defaults Click this button to edit the default configuration templates. The defaults are used for newly created configurations.
arrowUp or arrowDown Alt+Up or Alt+Down Use these buttons to move the selected configuration or folder up and down in the list.

The order of configurations or folders in the list defines the order in which configurations appear in the Run/Debug drop-down list on the main toolbar.

folder Move into new folder / Create new folder Use this button to create a new folder.

If one or more run/debug configurations are in focus, the selected run/debug configurations are automatically moved to the newly created folder. If only a category is in focus, an empty folder is created.

Move run/debug configurations to a folder using drag-and-drop, or the arrowUp arrowDown buttons.

sortAlphabetically Sort configurations Click this button to sort configurations in alphabetical order.

Common Options

Item Description
Name In this text box, specify the name of the current run/debug configuration. This field does not appear for the default run/debug configurations.
Defaults This node in the left-hand pane of the dialog box contains the default run/debug configuration settings. Select the desired configuration to change its default settings in the right-hand pane. The defaults are applied to all newly created run/debug configurations.
Share Select this check box to make the run/debug configuration available to other team members.

The shared run/debug configurations are kept in separate xml files under .idea\runConfigurations folder, while the local run/debug configurations are kept in the .idea\workspace.xml.

This check box is not available when editing the run/debug configuration defaults.

Single instance only If this check box is selected, this run/debug configuration cannot be launched more than once.

Every time a new run/debug configuration is launched, PyCharm checks the presence of the other instances of the same run/debug configuration, and displays a confirmation dialog box. If you click OK in the confirmation dialog box, the first instance of the runner will be stopped, and the next one will take its place.

This make sense, when usage of certain resources can cause conflicts, or when launching two run/debug configurations of the same type consumes too much of the CPU and memory resources.

If this check box is not selected, it is possible to launch as many instances of the runner as required. So doing, each runner will start in its own tab of the Run tool window.

Before launch Specify which tasks must be performed before applying the run/debug configuration. The specified tasks are performed in the order they appear in the list.
Item Keyboard shortcut Description
add Alt+Insert Click this icon to add a task to the list. Select the task to be added:
  • Run External tool. Select this option to run an application which is external to PyCharm. In the dialog that opens, select the application or applications that should be run. If the necessary application is not defined in PyCharm yet, add its definition. For more information, see Configuring Third-Party Tools and External Tools.
  • Run Another Configuration. Select this option to have another run/debug configuration executed. In the dialog that opens, select the configuration to be run.
  • Generate CoffeeScript Source Maps. Select this option to have the source maps for your CoffeeScript sources generated. In the dialog that opens, specify where your CoffeeScript source files are located. For more information, see CoffeeScript Support.
  • Run Remote External tool: Add a remote SSH external tool. Refer to the section Remote SSH External Tools for details.
delete Alt+Delete Click this icon to remove the selected task from the list.
edit1 Enter Click this icon to edit the selected task. Make the necessary changes in the dialog that opens.
arrowUp Alt+Up Click this icon to move the selected task one line up in the list.
arrowDown Alt+Down Click this icon to move the selected task one line down in the list.
Show this page Select this check box to have the run/debug configuration settings shown prior to actually starting the run/debug configuration.

See Also

Last modified: 3 February 2015
comments powered by Disqus