pycharm отладка кода python

Debug

There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Configure debugging options

If you are new to debugging, the out-of-the-box configuration will work for you. The topics about each debugger functionality provide references and explain the related settings where applicable. If you are an advanced user and looking for some particular property, see the Debugger reference section.

Under the Build, Execution and Deployment section, select Python Debugger, and configure the Python debugger options.

Under the Project | Python Interpreter section, configure the Python packages that might be required for some debugging configurations.

Define a run/debug configuration if you are going to use a custom one. This is required if you need some arguments to be passed to the program or some special activity to be performed before launch. For more information on how to set up run/debug configurations, refer to the Run/debug configurations section. Most of the time, you don’t need this to debug a simple program that doesn’t expect arguments or have any special requirements.

General debugging procedure

There is no one-size-fits-all procedure for debugging applications. Depending on actual requirements you may have to use different actions in different order. This topic provides general guidelines, which represent typical debugging steps. The details on how and when to use particular features are provided in the respective topics.

The alternative to using breakpoints is manually suspending the program at an arbitrary moment, however this method imposes some limitations on the debugger functionality and doesn’t allow for much precision as to when to suspend the program.

Just right-click any line in the editor and select the Debug command from the context menu.

After the program has been suspended, use the debugger to get the information about the state of the program and how it changes during running.

The debugger provides you with the information about variable values, the current state of the threads, breakdown of objects that are currently in the heap, and so on. It also allows you to test your program in various conditions by throwing exceptions (for example, to check how they are handled) or running arbitrary code right in the middle of the program execution.

While these tools let you examine the program state at a particular instant, the stepping feature gives you the control over step-by-step execution of the program. By combining the tools you can deduce where the bug is coming from and test your program for robustness.

Источник

Step 2. Debug your first Python application

Finding out the origin of the problem

Remember, in the previous tutorial you’ve created and run the Car script? Let’s play a little more with it and modify the average_speed function as follows:

Let’s see what happens when we start our script up, and try to find out our average speed:

pycharm отладка кода python. py run error. pycharm отладка кода python фото. pycharm отладка кода python-py run error. картинка pycharm отладка кода python. картинка py run error. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Let’s dig a little deeper into our code to find out what’s going wrong. We can use the PyCharm debugger to see exactly what’s happening in our code. To start debugging, you have to set some breakpoints first. To create breakpoints, just click in the gutter

pycharm отладка кода python. py breakpoints added. pycharm отладка кода python фото. pycharm отладка кода python-py breakpoints added. картинка pycharm отладка кода python. картинка py breakpoints added. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py debug menu command. pycharm отладка кода python фото. pycharm отладка кода python-py debug menu command. картинка pycharm отладка кода python. картинка py debug menu command. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

PyCharm starts a debugging session and shows the Debug tool window

pycharm отладка кода python. py debugToolWindow. pycharm отладка кода python фото. pycharm отладка кода python-py debugToolWindow. картинка pycharm отладка кода python. картинка py debugToolWindow. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py debugToolWindow1. pycharm отладка кода python фото. pycharm отладка кода python-py debugToolWindow1. картинка pycharm отладка кода python. картинка py debugToolWindow1. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py debugToolWindow2. pycharm отладка кода python фото. pycharm отладка кода python-py debugToolWindow2. картинка pycharm отладка кода python. картинка py debugToolWindow2. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

The debugger also shows the error message. So we’ve found our problem. You can also see in the debugger, that the value self.time is equal to zero:

pycharm отладка кода python. . pycharm отладка кода python фото. pycharm отладка кода python-. картинка pycharm отладка кода python. картинка . There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Surrounding code

To avoid running into the same problem again, let’s add an if statement to check whether the time equals zero. To do that, select the statement return self.odometer / self.time in the method average_speed and then press Ctrl+Alt+T ( Code | Surround with ):

pycharm отладка кода python. py surround. pycharm отладка кода python фото. pycharm отладка кода python-py surround. картинка pycharm отладка кода python. картинка py surround. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

PyCharm creates a stub if construct, leaving you with the task of filling it with the proper contents.

pycharm отладка кода python. py surround if stub. pycharm отладка кода python фото. pycharm отладка кода python-py surround if stub. картинка pycharm отладка кода python. картинка py surround if stub. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

After editing, we get the following:

pycharm отладка кода python. py surround result. pycharm отладка кода python фото. pycharm отладка кода python-py surround result. картинка pycharm отладка кода python. картинка py surround result. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Let’s take a closer look to see how the debugger can show your what your code is doing.

Debugging in detail

The Debug tool window shows dedicated panes for frames, variables, and watches, and the console, where all the input and output information is displayed. If you want the console to be always visible, you can drag it to one of the PyCharm window’s edges.

Stepping

If you want to see what your code does line by line, there’s no need to put a breakpoint on every line, you can step through your code.

We can use the stepping toolbar buttons to choose on which line we’d like to stop next.

pycharm отладка кода python. py stepping toolbar. pycharm отладка кода python фото. pycharm отладка кода python-py stepping toolbar. картинка pycharm отладка кода python. картинка py stepping toolbar. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py debugging1 step over. pycharm отладка кода python фото. pycharm отладка кода python-py debugging1 step over. картинка pycharm отладка кода python. картинка py debugging1 step over. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py debugging1 step into. pycharm отладка кода python фото. pycharm отладка кода python-py debugging1 step into. картинка pycharm отладка кода python. картинка py debugging1 step into. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. . pycharm отладка кода python фото. pycharm отладка кода python-. картинка pycharm отладка кода python. картинка . There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Watching

pycharm отладка кода python. py debugging1 watch completion. pycharm отладка кода python фото. pycharm отладка кода python-py debugging1 watch completion. картинка pycharm отладка кода python. картинка py debugging1 watch completion. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

At first, you see the time equals nil- it means that the variable is not yet defined:

pycharm отладка кода python. py debugging1 watch error. pycharm отладка кода python фото. pycharm отладка кода python-py debugging1 watch error. картинка pycharm отладка кода python. картинка py debugging1 watch error. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

However, when the program execution continues to the scope that defines the variable, the watch gets the following view:

pycharm отладка кода python. py debugging1 watch normal. pycharm отладка кода python фото. pycharm отладка кода python-py debugging1 watch normal. картинка pycharm отладка кода python. картинка py debugging1 watch normal. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

See Watches section for details.

Inline debugging

You may have noticed another PyCharm feature that makes it easy to see what your code is doing: the inline debugger. As soon as you press any breakpoint, PyCharm shows you the value of many of your variables right in the editor:

pycharm отладка кода python. py debugging inline. pycharm отладка кода python фото. pycharm отладка кода python-py debugging inline. картинка pycharm отладка кода python. картинка py debugging inline. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

pycharm отладка кода python. py inline debugging command. pycharm отладка кода python фото. pycharm отладка кода python-py inline debugging command. картинка pycharm отладка кода python. картинка py inline debugging command. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Evaluating expressions

Then in the dialog that opens, click Evaluate :

pycharm отладка кода python. . pycharm отладка кода python фото. pycharm отладка кода python-. картинка pycharm отладка кода python. картинка . There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Actually, you could see the same thing with a watch. With evaluate expression you can do things that you can’t do with a watch: you can change things.

For example, if you enter the desired value of the odometer, say, 50, and then continue stepping through your script, you will get the following:

pycharm отладка кода python. . pycharm отладка кода python фото. pycharm отладка кода python-. картинка pycharm отладка кода python. картинка . There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

See the Evaluate expressions section for details.

pycharm отладка кода python. py debugging python console. pycharm отладка кода python фото. pycharm отладка кода python-py debugging python console. картинка pycharm отладка кода python. картинка py debugging python console. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Summary

So, you’ve done it! Congrats! Let’s repeat what you’ve done with the help of PyCharm:

Источник

Remote Debugging with PyCharm

With PyCharm you can debug your application using an interpreter that is located on the other computer, for example, on a web server or dedicated test machine.

PyCharm provides two ways to debug remotely:

Case: Use this approach to leverage extended debugging capabilities available on the remote machine.

Requirements: SSH access from the local machine to the remote server.

Case: Use this approach to integrate the debugging process into the series of running processes on the remote server. This might be helpful when you cannot explicitly run your application for debugging, or when some preparations tasks are required.

Requirements: SSH access from the local machine to the remote server, access from the remote server to the local machine using any predefined port.

Before you start

Complete the following preparation tasks:

On the local machine, create a pure Python project, as described in the section Create a Python project.

Add the following code to the Python File :

Creating a deployment configuration for a remote interpreter

Configure a remote interpreter

Ensure that you have SSH access to the remote machine.

Add a new remote interpreter to the project as described in Configure an interpreter using SSH specifying the credentials to connect to the remote machine.

Once you create the remote interpreter for your project, the corresponding deployment configuration is created. To preview it, click Ctrl+Alt+S to open the Settings dialog window on the local machine, then click the Build, Execution, Deployment node and the Deployment node. pycharm отладка кода python. py remote debugging deployment config. pycharm отладка кода python фото. pycharm отладка кода python-py remote debugging deployment config. картинка pycharm отладка кода python. картинка py remote debugging deployment config. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

You can accept all default settings or alter them, if needed. For this example, let’s use a meaningful name for your deployment configuration, for example, «MySFTPConnection».

Ensure that the Root path value reflects the path specified in the corresponding settings of the created SSH interpreter.

pycharm отладка кода python. py remote debugging path mappings. pycharm отладка кода python фото. pycharm отладка кода python-py remote debugging path mappings. картинка pycharm отладка кода python. картинка py remote debugging path mappings. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Now your deployment configuration is ready.

Deploy your application to a remote host

Next, your application must be deployed to the remote host.

File Transfer tool window appears. Verify the number of transferred files.

pycharm отладка кода python. py remote debugging ftp. pycharm отладка кода python фото. pycharm отладка кода python-py remote debugging ftp. картинка pycharm отладка кода python. картинка py remote debugging ftp. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Debug your application

Right-click the editor background and choose the Debug (here Debug ‘quadratic_equation’ ).

Review the debugging output. Note that debugging actually takes place on the specified remote server.

pycharm отладка кода python. py remote debugging. pycharm отладка кода python фото. pycharm отладка кода python-py remote debugging. картинка pycharm отладка кода python. картинка py remote debugging. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Remote debugging with the Python remote debug server configuration

You can also enable remote debugging with the dedicated run/debug configuration, namely, Run/Debug Configuration: Python Debug.

Create a run/debug configuration

pycharm отладка кода python. py python remote debug configuration. pycharm отладка кода python фото. pycharm отладка кода python-py python remote debug configuration. картинка pycharm отладка кода python. картинка py python remote debug configuration. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Map the path on the local machine to the path on the remote machine:

pycharm отладка кода python. py path mapping in debug server. pycharm отладка кода python фото. pycharm отладка кода python-py path mapping in debug server. картинка pycharm отладка кода python. картинка py path mapping in debug server. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Inspect the Update your script instructions. You can use the pydevd-pycharm.egg from the PyCharm installation (

/debug-egg/pydevd-pycharm.egg ) or install the pydevd-pycharm package using pip.

Depending on your choice, perform the following changes:

Install the pydevd-pycharm package on the remote machine by running the following command:

pip install pydevd-pycharm

for example, pip install pydevd-pycharm

Modify the source code file as follows:

Modify the code as follows:

Create a SFTP connection

On the remote machine, create a directory where the file quadratic_equation.py should be uploaded. You can do it in the Terminal window:

In the Connection tab, specify the SFTP host (address of the remote machine), username and password for that machine.

Note that the specified user should have SSH access to the remote host.

Deploy files to the remote machine

Inspect the File Transfer dialog window to ensure that the files from the local machine are uploaded to the remote server.

pycharm отладка кода python. py sftp deployment upload. pycharm отладка кода python фото. pycharm отладка кода python-py sftp deployment upload. картинка pycharm отладка кода python. картинка py sftp deployment upload. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Launch the Debug Server

pycharm отладка кода python. py remote debug. pycharm отладка кода python фото. pycharm отладка кода python-py remote debug. картинка pycharm отладка кода python. картинка py remote debug. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Ensure that the Debug tool window shows the Waiting for process connection.. message. This message will be shown until you launch your script on the remote machine, and this script will connect to the Debug Server.

Execute the Python file on the remote machine

On the remote machine, navigate to the tmp/pycharm_project_986 directory.

Launch the quadratic_equation.py file on the remote host. To do that, in the Terminal window, enter the following command:

The most helpful aspect of this debugging method is that you can run execution the Python file using any of your bash scripts when remote debugging is part of a scheduled task or when you need to execute some preparation steps before running the Python script. If that’s the case, add the following lines to the appropriate place of your bash script:

Debug your application

On your local machine, switch to the Debug tool window. It should show the connection to the pydev debugger.

pycharm отладка кода python. py remote debug result. pycharm отладка кода python фото. pycharm отладка кода python-py remote debug result. картинка pycharm отладка кода python. картинка py remote debug result. There is a variety of ways how you can run a debugging session, however, for simplicity this documentation assumes that you are building and running your project from PyCharm. This is the most common case, and it has fewer limitations as compared to more advanced techniques. The procedures for attaching to a process and debugging a remote application are covered in separate sections.

Your code is actually executed on the remote host, but debugged on the local machine.

Summary

In order to debug with a remote interpreter, you have to start your program through PyCharm, which is not always possible. On the other hand, when using the Debug Server, you can connect to a running process.

Источник

Run/Debug Configuration: Python

When you run your application for the very first time, PyCharm automatically creates the temporary Run/Debug configuration. You can modify it to specify or alter the default parameters and save it as a permanent Run/Debug configuration.

Prerequisites

Refer to their respective download and installation pages for details:

Configuration tab

In this field, specify parameters to be passed to the Python script.

When specifying the script parameters, follow these rules:

Use spaces to separate individual script parameters.

If script parameter includes double quotes, escape the double quotes with backslashes, for example:

In this field you can add a macros to pass various project- or context-specific values when running a run/debug configuration. Click + and select one of the available macros from the list. See Adding macros to run/debug configuration for more details.

This field shows the list of environment variables. If the list contains several variables, they are delimited with semicolons.

By default, the field contains the variable PYTHONUNBUFFERED set to 1. To fill in the list, click the browse button, or press Shift+Enter and specify the desired set of environment variables in the Environment Variables dialog.

You might want to populate the list with the variables stored as a series of records in a text file, for example:

Select one of the pre-configured Python interpreters from the list.

When PyCharm stops supporting any of the outdated Python versions, the corresponding Python interpreter is marked as unsupported.

Specify a directory to be used by the running task.

When this field is left blank, the bin directory of the PyCharm installation will be used.

Note that emulating terminal in the output console differs from running the Terminal that is a separate tool window used for running system shell commands.

ItemDescription
Script path/Module nameClick the list to select a type of target to run. Then, in the corresponding field, specify the path to the Python script or the module name to be executed.
Parameters
Run with Python consoleEnables running your script or module with the Python console.
Redirect input fromEnables redirecting data from a text file to standard input. Use this option if your script requires some input and you want to automatically submit the values instead of typing them in the Run console. To enable redirecting, select the checkbox and specify the path to the target text file.
Docker container settings

This field only appears when a Docker-based remote interpreter is selected for a project..

Run options : Use this field to specify the Docker command-line options.

This field only appears when a Docker Compose-based remote interpreter is selected.

You can use the following commands of the Docker Compose Command-Line Interface:

You can expand this field to preview the complete command string.

Example: if you enter the following combination in the Commands and options field:

the preview output should looks as follows:

Logs tab

Use this tab to specify which log files generated while running or debugging should be displayed in the console, that is, on the dedicated tabs of the Run or Debug tool window.

The read-only fields in this column list the log files to show. The list can contain:

Full paths to specific files.

Aliases to substitute for full paths or patterns. These aliases are also displayed in the headers of the tabs where the corresponding log files are shown.

If a log entry pattern defines more than one file, the tab header shows the name of the file instead of the log entry alias.

ItemDescription
Is ActiveSelect checkboxes in this column to have the log entries displayed in the corresponding tabs in the Run tool window or Debug tool window.
Log File Entry
Skip ContentSelect this checkbox to have the previous content of the selected log skipped.
Save console output to fileSelect this checkbox to save the console output to the specified location. Type the path manually, or click the browse button and point to the desired location in the dialog that opens.
Show console when a message is printed to standard output streamSelect this checkbox to activate the output console and bring it forward if an associated process writes to Standard.out.
Show console when a message is printed to standard error streamSelect this checkbox to activate the output console and bring it forward if an associated process writes to Standard.err.
Click this button to open the Edit Log Files Aliases dialog where you can select a new log entry and specify an alias for it.
Click this button to edit the properties of the selected log file entry in the Edit Log Files Aliases dialog.
Click this button to remove the selected log entry from the list.
Click this button to edit the select log file entry. The button is available only when an entry is selected.

Common settings

When you edit a run configuration (but not a run configuration template), you can specify the following options:

Select to allow running multiple instances of this run configuration in parallel.

By default, it is disabled, and when you start this configuration while another instance is still running, PyCharm suggests to stop the running instance and start another one. This is helpful when a run/debug configuration consumes a lot of resources and there is no good reason to run multiple instances.

Toolbar

The tree view of run/debug configurations has a toolbar that helps you manage configurations available in your project as well as adjust default configurations templates.

Move into new folder / Create new folder. You can group run/debug configurations by placing them into folders.

ItemShortcutDescription
Alt+InsertCreate a run/debug configuration.
Alt+DeleteDelete the selected run/debug configuration. Note that you cannot delete default configurations.
Ctrl+DCreate a copy of the selected run/debug configuration. Note that you create copies of default configurations.
The button is displayed only when you select a temporary configuration. Click this button to save a temporary configuration as permanent.
Click this button to sort configurations in the alphabetical order.

Before launch

In this area, you can specify tasks to be performed before starting the selected run/debug configuration. The tasks are performed in the order they appear in the list.

Click this icon to add one of the following available tasks:

Run External tool : select to run an external application. In the dialog that opens, select one or multiple applications you want to run. If it is not defined in PyCharm yet, add its definition. For more information, see External tools and External Tools.

Run Another Configuration : select to execute another run/debug configuration. In the dialog that opens, select the configuration to be run.

Launch Web Browser : select this option to have a browser started. In the dialog that opens, select the type of the browser and provide the start URL. Also, specify if you want the browser be launched with JavaScript debugger.

Run File Watchers : select this option to have PyCharm apply all the currently active File Watchers.

Run Grunt task : select this option to run a Grunt task.

In the Grunt task dialog that opens, specify the Gruntfile.js where the required task is defined, select the task to execute, and specify the arguments to pass to the Grunt tool.

Specify the location of the Node.js interpreter, the parameters to pass to it, and the path to the grunt-cli package.

Run gulp task : select this option to run a Gulp task.

In the Gulp task dialog that opens, specify the Gulpfile.js where the required task is defined, select the task to execute, and specify the arguments to pass to the Gulp tool.

Specify the location of the Node.js interpreter, the parameters to pass to it, and the path to the gulp package.

Run npm script : select this option to execute an npm script.

In the NPM Script dialog that opens, specify the npm run/debug configuration settings.

Compile TypeScript : select to run the built-in TypeScript compiler and thus make sure that all the changes you made to your TypeScript code are reflected in the generated JavaScript files. In the TypeScript Compile Settings dialog that opens, select or clear the Check errors checkbox to configure the behaviour of the compiler in case any errors are detected:

    If the Check errors checkbox is selected, the compiler will show all the errors and the run configuration will not start.

    If the Check errors checkbox is cleared, the compiler will show all the detected errors but the run configuration still will be launched.

    Generate CoffeeScript Source Maps : select this option to generate the source maps for your CoffeeScript sources. In the dialog that opens, specify where your CoffeeScript source files are located.

    Run Remote External Tool : adds a remote SSH external tool.

    By default this checkbox is selected and the Run or the Debug tool window opens when you start the run/debug configuration.

    Источник

    Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *

    ItemShortcutDescription
    Alt+Insert