| 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 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 your local script:
from pydev 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.
pydev.pydevd.settrace(<host name>, port=<port number>)
where
- <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
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 , and the command
line is complemented with suspend=False
|