def _clear_ipython(): # TODO: In ipython 0.11 IP no longer exists. Also, %clear magic (clearcmd.py) has been put in quarantine folder. It is not clear to me what has replaced the functionality. possiby ip.cleanup, ip.clear_instance or ip.clear_main_mod_cache. try: ip = get_ipython() ip.IP.ipmagic('clear out') import gc gc.collect() except: pass
except: pass # Auto-start GUI if qt.config.get('startgui', True): qt.flow.start_gui() temp.File.set_temp_dir(qt.config['tempdir']) # change startdir if commandline option is given if __startdir__ is not None: qt.config['startdir'] = __startdir__ # FIXME: use of __startdir__ is spread over multiple scripts: # 1) source/qtlab_client_shell.py # 2) init/02_qtlab_start.py # This should be solved differently # Set exception handler try: import qtflow # Note: This does not seem to work for 'KeyboardInterrupt', # likely it is already caught by ipython itself. get_ipython().set_custom_exc((Exception, ), qtflow.exception_handler) except Exception, e: print 'Error: %s' % str(e) # Other functions should be registered using qt.flow.register_exit_handler from lib.misc import register_exit import qtflow register_exit(qtflow.qtlab_exit)