Have I done something wrong? Setting up the Python IDE configuration window

Apologies for the rubbish Subject but I'm finding it hard to explain.

Using PyCharm CE 3.0.2 on OSX 10.9

The problem is that unless I have a filename written in the script field (see screenshot) of Run\Debug Configurations window, I cannot run any files.

Therefore, I have to ensure I put the file I am currently working on, into the Script field.

When I have another file open and I press the Run Python green triangle the file that I am looking at does not run but the previous file runs.

If I leave the Script field blank, nothing will run. and the message "Run Configuration Error: Please specify script name" appears in the config window.


I'm pretty sure I've broken something! Can someone help rectify this so that the script I am currently looking at is the one that actually runs.

image1
1 comment
Comment actions Permalink
You have to have a run configuration for everything that you want to run from PyCharm. The button for run and debug always refer to the run configuration that is currently selected in the dropdown, not the file that is currently active in the editor.

Basically, there are two ways to get such a run configuration:
  1. Define it through the run configuration dropdown (there's an "Edit Configurations" item that opens to the dialog you have attached to your post. Fill in all required settings there); those use the fully colored icon in the drop down
  2. Create a temporary configuration (CTRL-SHIFT-F10 in the file/right click on file in tree and select Run <filename>); those use the lighter icon in the drop down

Thus, you can do the following:
  1. Open the the file that you want to run in the editor
  2. Press CTRL-SHIFT-F10

PyCharm then executes your file. If you need to provide command line parameters for that script, you can now choose "Edit Configuration" from the dropdown and set any options that are required and run again. I find this a lot simpler than creating run configurations manually before executing scripts.

You can find more information about run configurations in the PyCharm Online Help.

Hope that helps!
0

Please sign in to leave a comment.