From 2101ac2c8478535f7ab4aca78e509356cd488254 2006-02-01 20:08:48 From: vivainio Date: 2006-02-01 20:08:48 Subject: [PATCH] change "profile not found" warning heuristics (only warn if ipythonrc-PROFNAME and ipy_profile_PROFNAME not found) --- diff --git a/IPython/UserConfig/ipy_user_conf.py b/IPython/UserConfig/ipy_user_conf.py index cc8cb68..c3cefde 100644 --- a/IPython/UserConfig/ipy_user_conf.py +++ b/IPython/UserConfig/ipy_user_conf.py @@ -26,7 +26,10 @@ o.autocall = 1 if o.profile == 'pysh': # Jason Orendorff's path class is handy to have in user namespace # if you are doing shell-like stuff - ip.ex("from IPython.path import path" ) + try: + ip.ex("from path import path" ) + except ImportError: + pass # Uncomment these lines to get pysh-like prompt for all profiles. diff --git a/IPython/ipmaker.py b/IPython/ipmaker.py index 041f931..b3a39be 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 1115 2006-01-31 08:49:20Z vivainio $""" +$Id: ipmaker.py 1120 2006-02-01 20:08:48Z vivainio $""" #***************************************************************************** # Copyright (C) 2001-2006 Fernando Perez. @@ -419,9 +419,8 @@ object? -> Details about 'object'. ?object also works, ?? prints more. except IOError: if opts_all.debug: IP.InteractiveTB() opts.profile = '' # remove profile from options if invalid - warn('Profile configuration file %s not found. Ignoring request.' - % (opts_all.profile) ) - + # We won't warn anymore, primary method is ipy_profile_PROFNAME + # which does trigger a warning. # load the config file rcfiledata = None @@ -606,18 +605,26 @@ object? -> Details about 'object'. ?object also works, ?? prints more. try: import ipy_system_conf except ImportError: + if opts_all.debug: IP.InteractiveTB() warn("Could not import 'ipy_system_conf'") - pass + if opts_all.profile: profmodname = 'ipy_profile_' + opts_all.profile try: __import__(profmodname) except ImportError: - warn("Could not import '%s'" % profmodname) + # only warn if ipythonrc-PROFNAME didn't exist + if opts.profile =='': + warn("Could not start with profile '%s'!\n ('%s/%s.py' does not exist?)" % ( + opts_all.profile, ipythondir, profmodname) + + ) try: import ipy_user_conf except ImportError: - warn('Could not import ipy_user_conf') + if opts_all.debug: IP.InteractiveTB() + warn("Could not import user config!\n ('%s/ipy_user_conf.py' does not exist?)" % + ipythondir) # release stdout and stderr and save config log into a global summary msg.config.release_all()