From aa8c9348ef93d267ce0d175b73fa98a72fd039e4 2006-12-24 10:28:29 From: vivainio Date: 2006-12-24 10:28:29 Subject: [PATCH] More informative message in ipy_user_conf import failure (suggest running %upgrade) expand_aliases --- diff --git a/IPython/Release.py b/IPython/Release.py index 03da77f..57a549e 100644 --- a/IPython/Release.py +++ b/IPython/Release.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Release data for the IPython project. -$Id: Release.py 2010 2006-12-20 15:29:17Z vivainio $""" +$Id: Release.py 2012 2006-12-24 10:28:29Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez @@ -22,11 +22,11 @@ name = 'ipython' # because bdist_rpm does not accept dashes (an RPM) convention, and # bdist_deb does not accept underscores (a Debian convention). -revision = '2007' +revision = '2010M' -version = '0.7.3' +#version = '0.7.3' -#version = '0.7.3rc2.r' + revision.rstrip('M') +version = '0.7.4.svn.r' + revision.rstrip('M') description = "An enhanced interactive Python shell." diff --git a/IPython/ipapi.py b/IPython/ipapi.py index 91df0ee..4783845 100644 --- a/IPython/ipapi.py +++ b/IPython/ipapi.py @@ -275,6 +275,21 @@ class IPApi: error('could not get var. %s from %s' % (name,cf.f_code.co_name)) + def expand_alias(self,line): + """ Expand an alias in the command line + + Returns the provided command line, possibly with the first word + (command) translated according to alias expansion rules. + + [ipython]|16> _ip.expand_aliases("np myfile.txt") + <16> 'q:/opt/np/notepad++.exe myfile.txt' + """ + + pre,fn,rest = self.IP.split_user_input(line) + res = pre + self.IP.expand_aliases(fn,rest) + + + def launch_new_instance(user_ns = None): """ Make and start a new ipython instance. diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index 9d886f5..5c5fd5d 100644 --- a/IPython/ipmaker.py +++ b/IPython/ipmaker.py @@ -6,7 +6,7 @@ Requires Python 2.1 or better. This file contains the main make_IPython() starter function. -$Id: ipmaker.py 1979 2006-12-12 18:50:20Z vivainio $""" +$Id: ipmaker.py 2012 2006-12-24 10:28:29Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -627,8 +627,8 @@ object? -> Details about 'object'. ?object also works, ?? prints more. warn("Could not start with profile '%s'!\n" "('%s/%s.py' does not exist? run '%%upgrade')" % (opts_all.profile, opts_all.ipythondir, profmodname) ) - except: - print "Error importing",profmodname + except: + print "Error importing",profmodname,"- perhaps you should run %upgrade?" IP.InteractiveTB() import_fail_info(profmodname) @@ -640,7 +640,7 @@ object? -> Details about 'object'. ?object also works, ?? prints more. "('%s/ipy_user_conf.py' does not exist? Please run '%%upgrade')\n" % opts_all.ipythondir) except: - print "Error importing ipy_user_conf" + print "Error importing ipy_user_conf - perhaps you should run %upgrade?" IP.InteractiveTB() import_fail_info("ipy_user_conf") diff --git a/doc/ChangeLog b/doc/ChangeLog index 4a1567b..0339550 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,16 @@ +2006-12-24 Ville Vainio + + * ipmaker.py: more informative message when ipy_user_conf + import fails (suggest running %upgrade). + 2006-12-20 Ville Vainio * 0.7.3 is out - merge all from 0.7.3 branch to trunk + * ipapi.py: Add new ipapi method, expand_alias. + + * Release.py: Bump up version to 0.7.4.svn + 2006-12-17 Ville Vainio * Extensions/jobctrl.py: Fixed &cmd arg arg...