The IVLE Console is a programming console for Python which provides features similar to the Python command line console or IDLE GUI.
Using the console is fairly straightforward. Enter any valid Python code into the input text box located just to the right of the prompt (>>>
) at the bottom of the screen. When the line is complete, press ENTER to execute the code.
Sometimes Python may expect additional lines of input - for example, after the if
or for
statements. This condition is indicated by a ...
prompt next to the input. Complete the command by entering additional lines as required. Press ENTER with an empty line to mark the code block as complete and execute it.
Finally, some commands (such as raw_input()
) may expect further input from the user. In this case the prompt will be replaced with +++
to indicate that input other than Python code is required.
Please note that the console will time out after a period of inactivity. This has a similar result (and thus similar ramifications) to restarting the console manually.
>>>
i
name 'i' is not defined
>>>
i=2
>>>
print i
2
Each line that you have entered - as well as any output produced - is shown in the text area above the input. Lines beginning with a normal prompt (>>>
) are your input lines, while lines in red (such as invalid syntax (<input>, line 1)
) are generated errors or exceptions. Other lines are normal output from your code.
The IVLE console maintains a log of all entered commands in order to allow simple repetition of history. The up and down arrow keys will scroll backwards and forwards through the input history. As with any other line of code, pressing ENTER will execute the line currently in the input.
It is possible to enter commands that will render the console unusable or take a long time to complete (infinite loops like while True: print "Hello, world!"
, for example). You may terminate execution of the current command with the Interrupt button. This should allow you to resume entering of commands.
If things go really wrong, you can restart the console simply by clicking the Console tab. Be aware that you will lose all state (such as variables and functions) entered into your previous console session.