source: git/dyn_modules/python/ipython.sing @ d77a70

fieker-DuValspielwiese
Last change on this file since d77a70 was 3c473c, checked in by Kai Krüger <krueger@…>, 14 years ago
rename directory modules to dyn_modules anticipating "modules" directory for cmake. git-svn-id: file:///usr/local/Singular/svn/trunk@13033 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.3 KB
Line 
1LIB("python_module.so");
2Python_module::python("
3# This code loads IPython but modifies a few things if it detects it's running
4# embedded in another IPython session (helps avoid confusion)
5
6try:
7    __IPYTHON__
8except NameError:
9    argv = ['']
10    banner = exit_msg = ''
11else:
12    # Command-line options for IPython (a list like sys.argv)
13    argv = ['-pi1','In <\\#>:','-pi2','   .\\D.:','-po','Out<\\#>:']
14    banner = '*** Nested interpreter ***'
15    exit_msg = '*** Back in main IPython ***'
16
17# First import the embeddable shell class
18from IPython.Shell import IPShellEmbed
19# Now create the IPython shell instance. Put ipshell() anywhere in your code
20# where you want it to open.
21ipshell = IPShellEmbed(argv,banner=banner,exit_msg=exit_msg)
22ipshell()                           
23#---------------------------------------------------------------------------
24# This code will load an embeddable IPython shell always with no changes for
25# nested embededings.
26
27# Now ipshell() will open IPython anywhere in the code.
28
29#---------------------------------------------------------------------------
30# This code loads an embeddable shell only if NOT running inside
31# IPython. Inside IPython, the embeddable shell variable ipshell is just a
32# dummy function.
33
34
35#******************* End of file <example-embed-short.py> ********************
36");
37$;
Note: See TracBrowser for help on using the repository browser.