Code Editor

User guideCode Editor for Mac

Run Python locally

Read input in the console and save a repeatable run configuration.

Run a script that asks a question

  1. Open Sample Project and select ask.py. This script reads a name with input() and prints a greeting.
  2. Press ⌘R with the script active. When the console shows Your name:, enter Ada and submit it.
  3. Look for Hello, Ada! in Console. If the panel is hidden, use ⇧⌘Y to toggle it. To end a running script, choose Stop or press ⌘..
A Python program running with its output in the Mac editor
Read the program’s output in the workbench console.

Repeat a run with the same input

  1. In the project’s run menu, open Edit Configurations…. Choose or add a Local Python configuration and set the file to ask.py.
  2. Enter Ada in Stdin. Leave Working Folder set to the script’s folder. For scripts that read command-line options, enter those separately in Arguments.
  3. Choose Done, select that configuration and run it with ⌥⌘R. It prints the same greeting without waiting for typing. Clear Stdin to return to interactive input.

When a script waits or reads the wrong file

A script paused at input() is waiting for a line in Console. A relative path in open("data.txt") starts from the configured working folder. Choose the project root containing the data, or place the file beside the script if you use the default.

Local Python runs on your device. The separate Remote Run service for supported languages is a Pro feature and asks for consent to upload code. Web Preview runs page scripts inside the preview.