From 6f9baed1fad1fd7e2d5ee8018aaf732cd7be8898 2011-07-18 19:19:56 From: Hans Meine Date: 2011-07-18 19:19:56 Subject: [PATCH] simulate shell expansion on %run arguments, at least tilde expansion --- diff --git a/IPython/core/magic.py b/IPython/core/magic.py index 51704c5..afd3f4c 100644 --- a/IPython/core/magic.py +++ b/IPython/core/magic.py @@ -1591,7 +1591,11 @@ Currently the magic system has the following functions:\n""" # Make sure that the running script gets a proper sys.argv as if it # were run from a system shell. save_argv = sys.argv # save it for later restoring - sys.argv = [filename]+ arg_lst[1:] # put in the proper filename + + # simulate shell expansion on arguments, at least tilde expansion + args = map(os.path.expanduser, arg_lst[1:]) + + sys.argv = [filename]+ args # put in the proper filename if opts.has_key('i'): # Run in user's interactive namespace