From b51eaffc8eaabf7257df8d920e984c43011c29a0 Mon Sep 17 00:00:00 2001 From: Tim Vieira Date: Tue, 7 Jan 2014 21:07:21 -0500 Subject: [PATCH] remove deprecation warning --- Makefile | 3 +-- src/Dyna/Backend/Python/utils.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index cf5c48c..ce9e5e2 100644 --- a/Makefile +++ b/Makefile @@ -75,8 +75,7 @@ sphinxbuild: (cd docs/sphinx; make html) sphinxdoc: sphinxbuild - python -c 'import webbrowser; \ - webbrowser.open("./docs/sphinx/_build/html/index.html")' + python -m webbrowser "./docs/sphinx/_build/html/index.html" doc: sphinxbuild haddock diff --git a/src/Dyna/Backend/Python/utils.py b/src/Dyna/Backend/Python/utils.py index 63bd66b..648b45c 100644 --- a/src/Dyna/Backend/Python/utils.py +++ b/src/Dyna/Backend/Python/utils.py @@ -1,6 +1,14 @@ import re from external.path import path # used by other modules -from IPython.frontend.terminal.embed import InteractiveShellEmbed + +try: + from IPython import embed as ip +except ImportError: + from IPython.frontend.terminal.embed import InteractiveShellEmbed + # interactive IPython shell + ip = InteractiveShellEmbed(banner1 = 'Dropping into IPython\n') + + from config import dynahome, dotdynadir from collections import namedtuple, defaultdict from cStringIO import StringIO @@ -75,10 +83,6 @@ def user_vars(variables): if name.startswith('u') and not name.startswith('u_')) -# interactive IPython shell -ip = InteractiveShellEmbed(banner1 = 'Dropping into IPython\n') - - def get_module(cmd, sub): try: exec 'from %s.%s import %s as m' % (cmd, sub, sub) -- 2.50.1