On Aug 18, 12:55 pm, Carlos <carlosgali...@gmail.com> wrote: > Hi, > > I get the following: > > C:\web2py>python web2py.py -S myapp -M -N > web2py Web Framework > Created by Massimo Di Pierro, Copyright 2007-2011 > Version 1.98.2 (2011-08-18 05:41:57) > Database drivers available: SQLite3, pymysql, PostgreSQL > *WARNING:web2py:import IPython error; use default python shell* > Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] > on win32 > Type "help", "copyright", "credits" or "license" for more information. > (InteractiveConsole) > >
So, if we want it to work for both new and older versions of IPython, we could use the following: # ================================================================================== try: import IPython if IPython.__version__ >= '0.11': from IPython.frontend.terminal.embed import InteractiveShellEmbed shell = InteractiveShellEmbed(user_ns=_env) shell() return else: # following 2 lines fix a problem with IPython; thanks Michael Toomim if '__builtins__' in _env: del _env['__builtins__'] shell = IPython.Shell.IPShell(argv=[], user_ns=_env) shell.mainloop() return except: logger.warning( 'import IPython error; use default python shell') # ================================================================================== I'm a little uncomfortable doing a compare greater than or equal on a string, but it seems to work. An alternative is to require IPython version 0.11 or later, but I suppose that is a bit severe. - Dave