Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675

Warning: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 671

Warning: preg_replace(): Compilation failed: group name must start with a non-digit at offset 4 in /home/fuzzyman/webapps/www.ironpython.info/includes/MagicWord.php on line 675
Interactive Interpreter - IronPython Cookbook

Interactive Interpreter

From IronPython Cookbook

(formatting)
 
Line 1: Line 1:
-
[[Image:Interactive-interpreter.jpg]]
+
[[Image:Interactive-interpreter.jpg|The IronPython Interactive Interpreter]]
 +
 
 +
Both Python and IronPython can be used in interactive interpreter mode. This makes a great calculator, but is also a really good way of trying out language features or experimenting with libraries. You can also perform simple scripting tasks like inspecting files or databases.
 +
 
 +
To launch the interactive interpreter, run '''ipy''' from the command line. 
 +
 
 +
Individual commands, or blocks of code, can be typed here and are executed immediately.  The results are displayed in the console window.  You can access the last result through the magic variable '_'.
 +
 
 +
'''ipy''' (ipy.exe on Windows, and ipy on Unix) comes in the IronPython zipfile, which also has a tutorial to help you get started.
 +
 
 +
To enable syntax highlighting and tab completion in the interpreter, start '''ipy''' with the following arguments:
 +
 
 +
    <tt>ipy -D -X:TabCompletion -X:ColorfulConsole</tt>
 +
 
 +
If you're not used to working at the command line on Windows, you might find the following article useful: [http://www.voidspace.org.uk/python/articles/command_line.shtml The Windows Command Line].
 +
 
 +
For help getting started with Python, see the resources in the [[Useful Links]] page.
 +
 
 +
== Exiting IronPython ==
 +
 
 +
To finish your IronPython session, you can press Control-Z followed by the return key. 
 +
 
 +
On Linux and MacOS X while using Mono, you must use Control-D followed by the return key (on Unix, Control-D is the end of file terminator):
 +
 
 +
[[Image:Screenshot125.png]]
 +
 
 +
And control-z is typically bound to "suspend process" which places IronPython in the background, for example:
 +
 
 +
[[Image:Screenshot124.png]]
 +
 
 +
In that case, you can just resume your session by typing the <tt>fg</tt> command in the shell, or you can kill the process by determining the process id (PID) of the command and then using the kill command (use jobs -p to get a list of PIDs associated with the jobs, followed by the kill command).
 +
 
 +
Back to [[Contents]].

Current revision as of 03:58, 18 December 2007

TOOLBOX
LANGUAGES